Skip to content

Commit 7a6b900

Browse files
committed
Remove redundant CharSet from StructLayout attributes
Remove explicit `CharSet` values from `[StructLayout]` attributes applied to structs that do not contain `char`, `string`, or `StringBuilder` fields.
1 parent e25ade3 commit 7a6b900

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/Microsoft.PowerShell.CoreCLR.Eventing/DotNetCode/Eventing/UnsafeNativeMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ internal struct SystemTime
263263
public short Milliseconds;
264264
}
265265

266-
[StructLayout(LayoutKind.Explicit, CharSet = CharSet.Unicode)]
266+
[StructLayout(LayoutKind.Explicit)]
267267
[SecurityCritical]
268268
internal struct EvtVariant
269269
{

src/System.Management.Automation/engine/remoting/fanin/WSManNativeAPI.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ private struct WSManDWordDataInternal
928928
/// sequencing of data. Because of this the following structure will
929929
/// have only one string to hold stream information.
930930
/// </summary>
931-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
931+
[StructLayout(LayoutKind.Sequential)]
932932
internal struct WSManStreamIDSetStruct
933933
{
934934
internal int streamIDsCount;
@@ -1078,7 +1078,7 @@ internal struct WSManOption
10781078
/// <summary>
10791079
/// Unmanaged to Managed: WSMAN_OPERATION_INFO includes the struct directly, so this cannot be made internal to WsmanOptionSet.
10801080
/// </summary>
1081-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
1081+
[StructLayout(LayoutKind.Sequential)]
10821082
internal struct WSManOptionSetStruct
10831083
{
10841084
internal int optionsCount;
@@ -1326,7 +1326,7 @@ internal static WSManCommandArgSet UnMarshal(IntPtr unmanagedData)
13261326

13271327
internal struct WSManShellDisconnectInfo : IDisposable
13281328
{
1329-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
1329+
[StructLayout(LayoutKind.Sequential)]
13301330
private struct WSManShellDisconnectInfoInternal
13311331
{
13321332
/// <summary>
@@ -1544,7 +1544,7 @@ internal static WSManEnvironmentVariableSet UnMarshal(IntPtr unmanagedData)
15441544
return result;
15451545
}
15461546

1547-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
1547+
[StructLayout(LayoutKind.Sequential)]
15481548
private struct WSManEnvironmentVariableSetInternal
15491549
{
15501550
internal uint varsCount;
@@ -1567,7 +1567,7 @@ internal struct WSManEnvironmentVariableInternal
15671567
/// </summary>
15681568
internal class WSManProxyInfo : IDisposable
15691569
{
1570-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
1570+
[StructLayout(LayoutKind.Sequential)]
15711571
private struct WSManProxyInfoInternal
15721572
{
15731573
public int proxyAccessType;
@@ -2232,7 +2232,7 @@ internal static WSManOperationInfo UnMarshal(IntPtr unmanagedData)
22322232
/// selectorSet and optionSet are handled differently because they are structs that contain pointers to arrays of structs.
22332233
/// Most other data structures in the API point to structures using IntPtr rather than including the actual structure.
22342234
/// </summary>
2235-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
2235+
[StructLayout(LayoutKind.Sequential)]
22362236
private struct WSManOperationInfoInternal
22372237
{
22382238
internal WSManFragmentInternal fragment;
@@ -2304,7 +2304,7 @@ internal static WSManSelectorSet UnMarshal(WSManSelectorSetStruct resultInternal
23042304
/// <summary>
23052305
/// Managed representation of WSMAN_SELECTOR_SET.
23062306
/// </summary>
2307-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
2307+
[StructLayout(LayoutKind.Sequential)]
23082308
internal struct WSManSelectorSetStruct
23092309
{
23102310
internal int numberKeys;

src/System.Management.Automation/engine/remoting/fanin/WSManPlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ internal enum WSManPluginErrorCodes : int
8989
/// Explicit destruction and release of the IntPtrs is not required because
9090
/// their lifetime is managed by WinRM.
9191
/// </summary>
92-
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
92+
[StructLayout(LayoutKind.Sequential)]
9393
internal class WSManPluginOperationShutdownContext // TODO: Rename to OperationShutdownContext when removing the MC++ module.
9494
{
9595
#region Internal Members

0 commit comments

Comments
 (0)