Skip to content

Commit a02b49a

Browse files
authored
Add the CustomTypeMarshallerAttribute type to make it easier to identify marshaller types (#65591)
1 parent 3c126e6 commit a02b49a

File tree

65 files changed

+5337
-3147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+5337
-3147
lines changed

docs/design/libraries/LibraryImportGenerator/SpanMarshallers.md

Lines changed: 116 additions & 71 deletions
Large diffs are not rendered by default.

docs/design/libraries/LibraryImportGenerator/StructMarshalling.md

Lines changed: 116 additions & 54 deletions
Large diffs are not rendered by default.

docs/project/list-of-diagnostics.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,15 @@ The diagnostic id values reserved for .NET Libraries analyzer warnings are `SYSL
158158
| __`SYSLIB1052`__ | Specified configuration is not supported by source-generated P/Invokes |
159159
| __`SYSLIB1053`__ | Current target framework is not supported by source-generated P/Invokes |
160160
| __`SYSLIB1054`__ | Specified LibraryImportAttribute arguments cannot be forwarded to DllImportAttribute |
161-
| __`SYSLIB1055`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
162-
| __`SYSLIB1056`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
163-
| __`SYSLIB1057`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
164-
| __`SYSLIB1058`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
165-
| __`SYSLIB1059`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
166-
| __`SYSLIB1060`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
167-
| __`SYSLIB1061`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
168-
| __`SYSLIB1062`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
169-
| __`SYSLIB1063`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
170-
| __`SYSLIB1064`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
171-
| __`SYSLIB1065`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
172-
| __`SYSLIB1066`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
173-
| __`SYSLIB1067`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
174-
| __`SYSLIB1068`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
175-
| __`SYSLIB1069`__ | *_`SYSLIB1055`-`SYSLIB1069` reserved for Microsoft.Interop.LibraryImportGenerator._* |
161+
| __`SYSLIB1055`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
162+
| __`SYSLIB1056`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
163+
| __`SYSLIB1057`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
164+
| __`SYSLIB1058`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
165+
| __`SYSLIB1059`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
166+
| __`SYSLIB1060`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
167+
| __`SYSLIB1061`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
168+
| __`SYSLIB1062`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
169+
| __`SYSLIB1063`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
170+
| __`SYSLIB1064`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
171+
| __`SYSLIB1065`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |
172+
| __`SYSLIB1066`__ | *_`SYSLIB1055`-`SYSLIB1066` reserved for Microsoft.Interop.LibraryImportGenerator._* |

eng/generators.targets

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,14 @@
5252
Include="$(CoreLibSharedDir)System\Runtime\InteropServices\StringMarshalling.cs" />
5353

5454
<!-- Only add the following files if we are on the latest TFM (that is, net7). -->
55-
<Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'" Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\GeneratedMarshallingAttribute.cs" />
55+
<Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'"
56+
Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\GeneratedMarshallingAttribute.cs" />
57+
<Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'"
58+
Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\CustomTypeMarshallerKind.cs" />
59+
<Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'"
60+
Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\CustomTypeMarshallerDirection.cs" />
61+
<Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'"
62+
Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\CustomTypeMarshallerFeatures.cs" />
5663

5764
<!-- Only add the following files if we are on the latest TFM (that is, net7) and the project is SPCL or has references to System.Runtime.CompilerServices.Unsafe and System.Memory -->
5865
<Compile Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)'

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InternalCalls.cs

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal enum ClassLibFunctionId
4646
IDynamicCastableGetInterfaceImplementation = 9,
4747
}
4848

49-
internal static partial class InternalCalls
49+
internal static class InternalCalls
5050
{
5151
//
5252
// internalcalls for System.GC.
@@ -59,24 +59,24 @@ internal static void RhCollect(int generation, InternalGCCollectionMode mode)
5959
RhpCollect(generation, mode);
6060
}
6161

62-
[LibraryImport(Redhawk.BaseName)]
62+
[DllImport(Redhawk.BaseName)]
6363
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
64-
private static partial void RhpCollect(int generation, InternalGCCollectionMode mode);
64+
private static extern void RhpCollect(int generation, InternalGCCollectionMode mode);
6565

6666
[RuntimeExport("RhGetGcTotalMemory")]
6767
internal static long RhGetGcTotalMemory()
6868
{
6969
return RhpGetGcTotalMemory();
7070
}
7171

72-
[LibraryImport(Redhawk.BaseName)]
72+
[DllImport(Redhawk.BaseName)]
7373
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
74-
private static partial long RhpGetGcTotalMemory();
74+
private static extern long RhpGetGcTotalMemory();
7575

7676
[RuntimeExport("RhStartNoGCRegion")]
7777
internal static int RhStartNoGCRegion(long totalSize, bool hasLohSize, long lohSize, bool disallowFullBlockingGC)
7878
{
79-
return RhpStartNoGCRegion(totalSize, hasLohSize, lohSize, disallowFullBlockingGC);
79+
return RhpStartNoGCRegion(totalSize, hasLohSize ? Interop.BOOL.TRUE : Interop.BOOL.FALSE, lohSize, disallowFullBlockingGC ? Interop.BOOL.TRUE : Interop.BOOL.FALSE);
8080
}
8181

8282
[RuntimeExport("RhEndNoGCRegion")]
@@ -282,53 +282,55 @@ internal static extern unsafe bool RhpCallFilterFunclet(
282282
// These either do not need to be called in cooperative mode or, in some cases, MUST be called in preemptive
283283
// mode. Note that they must use the Cdecl calling convention due to a limitation in our .obj file linking
284284
// support.
285+
// We use DllImport here instead of DllImport as we don't want to add a dependency on source-generated
286+
// interop support to Test.CoreLib.
285287
//------------------------------------------------------------------------------------------------------------
286288

287289
// Block the current thread until at least one object needs to be finalized (returns true) or
288290
// memory is low (returns false and the finalizer thread should initiate a garbage collection).
289-
[LibraryImport(Redhawk.BaseName)]
291+
[DllImport(Redhawk.BaseName)]
290292
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
291-
internal static partial uint RhpWaitForFinalizerRequest();
293+
internal static extern uint RhpWaitForFinalizerRequest();
292294

293295
// Indicate that the current round of finalizations is complete.
294-
[LibraryImport(Redhawk.BaseName)]
296+
[DllImport(Redhawk.BaseName)]
295297
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
296-
internal static partial void RhpSignalFinalizationComplete();
298+
internal static extern void RhpSignalFinalizationComplete();
297299

298-
[LibraryImport(Redhawk.BaseName)]
300+
[DllImport(Redhawk.BaseName)]
299301
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
300-
internal static partial void RhpAcquireCastCacheLock();
302+
internal static extern void RhpAcquireCastCacheLock();
301303

302-
[LibraryImport(Redhawk.BaseName)]
304+
[DllImport(Redhawk.BaseName)]
303305
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
304-
internal static partial void RhpReleaseCastCacheLock();
306+
internal static extern void RhpReleaseCastCacheLock();
305307

306-
[LibraryImport(Redhawk.BaseName)]
308+
[DllImport(Redhawk.BaseName)]
307309
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
308-
internal static partial ulong RhpGetTickCount64();
310+
internal static extern ulong RhpGetTickCount64();
309311

310-
[LibraryImport(Redhawk.BaseName)]
312+
[DllImport(Redhawk.BaseName)]
311313
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
312-
internal static partial void RhpAcquireThunkPoolLock();
314+
internal static extern void RhpAcquireThunkPoolLock();
313315

314-
[LibraryImport(Redhawk.BaseName)]
316+
[DllImport(Redhawk.BaseName)]
315317
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
316-
internal static partial void RhpReleaseThunkPoolLock();
318+
internal static extern void RhpReleaseThunkPoolLock();
317319

318-
[LibraryImport(Redhawk.BaseName)]
320+
[DllImport(Redhawk.BaseName)]
319321
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
320-
internal static partial IntPtr RhAllocateThunksMapping();
322+
internal static extern IntPtr RhAllocateThunksMapping();
321323

322324
// Enters a no GC region, possibly doing a blocking GC if there is not enough
323325
// memory available to satisfy the caller's request.
324-
[LibraryImport(Redhawk.BaseName)]
326+
[DllImport(Redhawk.BaseName)]
325327
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
326-
internal static partial int RhpStartNoGCRegion(long totalSize, [MarshalAs(UnmanagedType.Bool)] bool hasLohSize, long lohSize, [MarshalAs(UnmanagedType.Bool)] bool disallowFullBlockingGC);
328+
internal static extern int RhpStartNoGCRegion(long totalSize, Interop.BOOL hasLohSize, long lohSize, Interop.BOOL disallowFullBlockingGC);
327329

328330
// Exits a no GC region, possibly doing a GC to clean up the garbage that
329331
// the caller allocated.
330-
[LibraryImport(Redhawk.BaseName)]
332+
[DllImport(Redhawk.BaseName)]
331333
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
332-
internal static partial int RhpEndNoGCRegion();
334+
internal static extern int RhpEndNoGCRegion();
333335
}
334336
}

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InteropServices/MarshalAsAttribute.cs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InteropServices/UnmanagedType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
namespace System.Runtime.InteropServices
55
{
6+
// Included because the C# compiler requires it for the unmanaged constraint
67
public enum UnmanagedType
78
{
8-
Bool = 0x2, // 4 byte boolean value (true != 0, false == 0)
99
}
1010
}

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,10 @@ public static unsafe int RhGetCurrentThreadStackTrace(IntPtr[] outputBuffer)
300300
return RhpGetCurrentThreadStackTrace(pOutputBuffer, (uint)((outputBuffer != null) ? outputBuffer.Length : 0), new UIntPtr(&pOutputBuffer));
301301
}
302302

303-
[LibraryImport(Redhawk.BaseName)]
303+
// Use DllImport here instead of LibraryImport because this file is used by Test.CoreLib.
304+
[DllImport(Redhawk.BaseName)]
304305
[UnmanagedCallConv(CallConvs = new Type[] { typeof(CallConvCdecl) })]
305-
private static unsafe partial int RhpGetCurrentThreadStackTrace(IntPtr* pOutputBuffer, uint outputBufferLength, UIntPtr addressInCurrentFrame);
306+
private static unsafe extern int RhpGetCurrentThreadStackTrace(IntPtr* pOutputBuffer, uint outputBufferLength, UIntPtr addressInCurrentFrame);
306307

307308
// Worker for RhGetCurrentThreadStackTrace. RhGetCurrentThreadStackTrace just allocates a transition
308309
// frame that will be used to seed the stack trace and this method does all the real work.

src/coreclr/nativeaot/Test.CoreLib/src/System/Runtime/RuntimeImports.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ internal static unsafe object RhNewObject(EETypePtr pEEType)
8585
internal static unsafe Array RhNewArray(EETypePtr pEEType, int length)
8686
=> RhNewArray(pEEType.ToPointer(), length);
8787

88-
[LibraryImport(RuntimeLibrary)]
89-
internal static unsafe partial void RhAllocateNewObject(IntPtr pEEType, uint flags, void* pResult);
88+
[DllImport(RuntimeLibrary)]
89+
internal static unsafe extern void RhAllocateNewObject(IntPtr pEEType, uint flags, void* pResult);
9090

9191
[MethodImpl(MethodImplOptions.InternalCall)]
9292
[RuntimeImport(RuntimeLibrary, "RhpFallbackFailFast")]

src/coreclr/nativeaot/Test.CoreLib/src/Test.CoreLib.csproj

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
44
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
55
<TargetFramework>netstandard2.0</TargetFramework>
6-
<EnableLibraryImportGenerator>true</EnableLibraryImportGenerator>
7-
<!--
8-
SYSLIB1053: LibraryImportGenerator Target Framework Not Supported.
9-
-->
10-
<NoWarn>$(NoWarn);SYSLIB1053</NoWarn>
116
</PropertyGroup>
127
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
138
<DefineConstants>FEATURE_GC_STRESS;$(DefineConstants)</DefineConstants>
@@ -33,6 +28,9 @@
3328
<IntermediatesDir>$(ArtifactsObjDir)\coreclr\$(TargetOS).$(TargetArchitecture).$(CoreCLRConfiguration)</IntermediatesDir>
3429
<IntermediatesDir Condition="'$(Ninja)' == 'false' and $([MSBuild]::IsOsPlatform('Windows'))">$(IntermediatesDir)\ide</IntermediatesDir>
3530
</PropertyGroup>
31+
<PropertyGroup>
32+
<CommonPath>$([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'Common', 'src'))</CommonPath>
33+
</PropertyGroup>
3634
<ItemGroup Condition="'$(InPlaceRuntime)' == 'true'">
3735
<Compile Include="..\..\Runtime.Base\src\System\Runtime\CachedInterfaceDispatch.cs">
3836
<Link>Runtime.Base\src\System\Runtime\CachedInterfaceDispatch.cs</Link>
@@ -67,9 +65,6 @@
6765
<Compile Include="..\..\Runtime.Base\src\System\Runtime\TypeCast.cs">
6866
<Link>Runtime.Base\src\System\Runtime\TypeCast.cs</Link>
6967
</Compile>
70-
<Compile Include="..\..\Runtime.Base\src\System\Runtime\InteropServices\MarshalAsAttribute.cs">
71-
<Link>Runtime.Base\src\System\Runtime\InteropServices\MarshalAsAttribute.cs</Link>
72-
</Compile>
7368
<Compile Include="..\..\Runtime.Base\src\System\Runtime\InteropServices\UnsafeGCHandle.cs">
7469
<Link>Runtime.Base\src\System\Runtime\InteropServices\UnsafeGCHandle.cs</Link>
7570
</Compile>
@@ -82,6 +77,9 @@
8277
<Compile Include="$(AotCommonPath)\Internal\Runtime\TransitionBlock.cs">
8378
<Link>Common\TransitionBlock.cs</Link>
8479
</Compile>
80+
<Compile Include="$(CommonPath)\Interop\Windows\Interop.BOOL.cs">
81+
<Link>Common\Interop\Windows\Interop.BOOL.cs</Link>
82+
</Compile>
8583
</ItemGroup>
8684
<ItemGroup Condition="'$(InPlaceRuntime)' == 'true'">
8785
<Compile Include="$(IntermediatesDir)\nativeaot\Runtime\Full\AsmOffsets.cs" />

src/libraries/Common/src/Interop/Interop.Ldap.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ internal struct SEC_WINNT_AUTH_IDENTITY_EX
4444
public string packageList;
4545
public int packageListLength;
4646

47+
#if NET7_0_OR_GREATER
48+
[CustomTypeMarshaller(typeof(SEC_WINNT_AUTH_IDENTITY_EX), Direction = CustomTypeMarshallerDirection.In, Features = CustomTypeMarshallerFeatures.UnmanagedResources)]
49+
#endif
4750
[StructLayout(LayoutKind.Sequential)]
4851
internal struct Native
4952
{
@@ -173,6 +176,7 @@ internal sealed class BerVal
173176
public IntPtr bv_val = IntPtr.Zero;
174177

175178
#if NET7_0_OR_GREATER
179+
[CustomTypeMarshaller(typeof(BerVal), Direction = CustomTypeMarshallerDirection.In, Features = CustomTypeMarshallerFeatures.TwoStageMarshalling)]
176180
internal unsafe struct PinningMarshaller
177181
{
178182
private readonly BerVal _managed;
@@ -183,7 +187,7 @@ public PinningMarshaller(BerVal managed)
183187

184188
public ref int GetPinnableReference() => ref (_managed is null ? ref Unsafe.NullRef<int>() : ref _managed.bv_len);
185189

186-
public void* Value => Unsafe.AsPointer(ref GetPinnableReference());
190+
public void* ToNativeValue() => Unsafe.AsPointer(ref GetPinnableReference());
187191
}
188192
#endif
189193
}
@@ -211,6 +215,7 @@ internal struct LdapReferralCallback
211215
#if NET7_0_OR_GREATER
212216
public static readonly unsafe int Size = sizeof(Marshaller.Native);
213217

218+
[CustomTypeMarshaller(typeof(LdapReferralCallback), Features = CustomTypeMarshallerFeatures.UnmanagedResources | CustomTypeMarshallerFeatures.TwoStageMarshalling)]
214219
public unsafe struct Marshaller
215220
{
216221
public unsafe struct Native
@@ -234,11 +239,9 @@ public Marshaller(LdapReferralCallback managed)
234239
_native.dereference = managed.dereference is not null ? Marshal.GetFunctionPointerForDelegate(managed.dereference) : IntPtr.Zero;
235240
}
236241

237-
public Native Value
238-
{
239-
get => _native;
240-
set => _native = value;
241-
}
242+
public Native ToNativeValue() => _native;
243+
244+
public void FromNativeValue(Native value) => _native = value;
242245

243246
public LdapReferralCallback ToManaged()
244247
{

src/libraries/Common/src/Interop/Windows/Advapi32/Interop.LsaLookupNames2.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ internal struct MARSHALLED_UNICODE_STRING
2626
internal ushort MaximumLength;
2727
internal string Buffer;
2828

29+
[CustomTypeMarshaller(typeof(MARSHALLED_UNICODE_STRING), Direction = CustomTypeMarshallerDirection.In, Features = CustomTypeMarshallerFeatures.UnmanagedResources)]
2930
public struct Native
3031
{
3132
internal ushort Length;

src/libraries/Common/src/Interop/Windows/CryptUI/Interop.CryptUIDlgCertificate.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ internal struct CRYPTUI_VIEWCERTIFICATE_STRUCTW
3737
internal uint nStartPage;
3838

3939
#if NET7_0_OR_GREATER
40+
[CustomTypeMarshaller(typeof(CRYPTUI_VIEWCERTIFICATE_STRUCTW), Features = CustomTypeMarshallerFeatures.UnmanagedResources)]
4041
internal unsafe struct Native
4142
{
4243
private uint dwSize;
@@ -139,6 +140,7 @@ internal struct CRYPTUI_SELECTCERTIFICATE_STRUCTW
139140
internal IntPtr hSelectedCertStore;
140141

141142
#if NET7_0_OR_GREATER
143+
[CustomTypeMarshaller(typeof(CRYPTUI_SELECTCERTIFICATE_STRUCTW), Features = CustomTypeMarshallerFeatures.UnmanagedResources)]
142144
internal unsafe struct Native
143145
{
144146
private uint dwSize;

src/libraries/Common/src/Interop/Windows/WebSocket/Interop.Structs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ internal struct HttpHeader
4949
internal string Value;
5050
internal uint ValueLength;
5151

52+
[CustomTypeMarshaller(typeof(HttpHeader), Direction = CustomTypeMarshallerDirection.In, Features = CustomTypeMarshallerFeatures.UnmanagedResources)]
5253
internal struct Native
5354
{
5455
private IntPtr Name;

0 commit comments

Comments
 (0)