Skip to content

Commit c99b5b0

Browse files
authored
Update design and expose new attributes for the CustomTypeMarshaller support (#71682)
1 parent a6d5f6b commit c99b5b0

File tree

31 files changed

+398
-364
lines changed

31 files changed

+398
-364
lines changed

.editorconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ csharp_space_between_square_brackets = false
154154
# License header
155155
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.
156156

157-
# Marshaller type must have CustomTypeMarshallerAttribute attribute
158-
dotnet_diagnostic.SYSLIB1056.severity = silent
159-
160157
# C++ Files
161158
[*.{cpp,h,in}]
162159
curly_bracket_next_line = true

docs/design/libraries/LibraryImportGenerator/UserTypeMarshallingV2.md

Lines changed: 112 additions & 122 deletions
Large diffs are not rendered by default.

eng/generators.targets

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
</PropertyGroup>
7070

7171
<ItemGroup Condition="'$(NetCoreAppCurrentTargetFrameworkMoniker)' == '$(TargetFrameworkMoniker)' and '$(IncludeLibraryImportGeneratorSources)' != 'false'">
72-
<Compile Include="$(LibrariesProjectRoot)System.Runtime.InteropServices/tests/Ancillary.Interop/CustomMarshallerAttribute.cs" />
73-
<Compile Include="$(LibrariesProjectRoot)System.Runtime.InteropServices/tests/Ancillary.Interop/Scenario.cs" />
7472
</ItemGroup>
7573
</Target>
7674

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ internal struct SEC_WINNT_AUTH_IDENTITY_EX
4949
public int packageListLength;
5050

5151
#if NET7_0_OR_GREATER
52-
[CustomMarshaller(typeof(SEC_WINNT_AUTH_IDENTITY_EX), Scenario.ManagedToUnmanagedIn, typeof(Marshaller))]
52+
[CustomMarshaller(typeof(SEC_WINNT_AUTH_IDENTITY_EX), MarshalMode.ManagedToUnmanagedIn, typeof(Marshaller))]
5353
internal static class Marshaller
5454
{
5555
public static Native ConvertToUnmanaged(SEC_WINNT_AUTH_IDENTITY_EX managed)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ internal struct CRYPTUI_VIEWCERTIFICATE_STRUCTW
4040
internal uint nStartPage;
4141

4242
#if NET7_0_OR_GREATER
43-
[CustomMarshaller(typeof(CRYPTUI_VIEWCERTIFICATE_STRUCTW), Scenario.Default, typeof(Marshaller))]
43+
[CustomMarshaller(typeof(CRYPTUI_VIEWCERTIFICATE_STRUCTW), MarshalMode.Default, typeof(Marshaller))]
4444
public static class Marshaller
4545
{
4646
public static Native ConvertToUnmanaged(CRYPTUI_VIEWCERTIFICATE_STRUCTW managed) => new(managed);
@@ -152,7 +152,7 @@ internal struct CRYPTUI_SELECTCERTIFICATE_STRUCTW
152152
internal IntPtr hSelectedCertStore;
153153

154154
#if NET7_0_OR_GREATER
155-
[CustomMarshaller(typeof(CRYPTUI_SELECTCERTIFICATE_STRUCTW), Scenario.Default, typeof(Marshaller))]
155+
[CustomMarshaller(typeof(CRYPTUI_SELECTCERTIFICATE_STRUCTW), MarshalMode.Default, typeof(Marshaller))]
156156
public static class Marshaller
157157
{
158158
public static Native ConvertToUnmanaged(CRYPTUI_SELECTCERTIFICATE_STRUCTW managed) => new(managed);

src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static partial bool WinHttpAddRequestHeaders(
5656
uint modifiers);
5757

5858
#if NET7_0_OR_GREATER
59-
[CustomMarshaller(typeof(StringBuilder), Scenario.ManagedToUnmanagedIn, typeof(SimpleStringBufferMarshaller))]
59+
[CustomMarshaller(typeof(StringBuilder), MarshalMode.ManagedToUnmanagedIn, typeof(SimpleStringBufferMarshaller))]
6060
private static unsafe class SimpleStringBufferMarshaller
6161
{
6262
public static void* ConvertToUnmanaged(StringBuilder builder)

src/libraries/Common/src/Interop/Windows/WinHttp/Interop.winhttp_types.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public struct WINHTTP_AUTOPROXY_OPTIONS
262262
[MarshalAs(UnmanagedType.Bool)]
263263
public bool AutoLoginIfChallenged;
264264
#if NET7_0_OR_GREATER
265-
[CustomMarshaller(typeof(WINHTTP_AUTOPROXY_OPTIONS), Scenario.Default, typeof(Marshaller))]
265+
[CustomMarshaller(typeof(WINHTTP_AUTOPROXY_OPTIONS), MarshalMode.Default, typeof(Marshaller))]
266266
public static class Marshaller
267267
{
268268
public static Native ConvertToUnmanaged(WINHTTP_AUTOPROXY_OPTIONS managed) => new(managed);

src/libraries/Common/src/Interop/Windows/WinMm/Interop.waveOutGetDevCaps.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal struct WAVEOUTCAPS
2828
private ushort wReserved1;
2929
private ushort dwSupport;
3030
#if NET7_0_OR_GREATER
31-
[CustomMarshaller(typeof(WAVEOUTCAPS), Scenario.Default, typeof(Marshaller))]
31+
[CustomMarshaller(typeof(WAVEOUTCAPS), MarshalMode.Default, typeof(Marshaller))]
3232
public static class Marshaller
3333
{
3434
public static Native ConvertToUnmanaged(WAVEOUTCAPS managed) => new(managed);

src/libraries/Common/src/Interop/Windows/WinSock/Interop.WinsockBSD.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ internal struct IPv6MulticastRequest
7575
internal byte[] MulticastAddress; // IP address of group.
7676
internal int InterfaceIndex; // Local interface index.
7777

78-
[CustomMarshaller(typeof(IPv6MulticastRequest), Scenario.Default, typeof(Marshaller))]
78+
[CustomMarshaller(typeof(IPv6MulticastRequest), MarshalMode.Default, typeof(Marshaller))]
7979
public static class Marshaller
8080
{
8181
public static Native ConvertToUnmanaged(IPv6MulticastRequest managed) => new(managed);

src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ internal struct EvtStringVariant
703703
public uint Type;
704704

705705
#if NET7_0_OR_GREATER
706-
[CustomMarshaller(typeof(EvtStringVariant), Scenario.Default, typeof(Marshaller))]
706+
[CustomMarshaller(typeof(EvtStringVariant), MarshalMode.Default, typeof(Marshaller))]
707707
public static class Marshaller
708708
{
709709
public static Native ConvertToUnmanaged(EvtStringVariant managed) => new(managed);

0 commit comments

Comments
 (0)