From 9a735fd59ba99d4a6d2590117b1d4670c0b01acb Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:05:34 -0700 Subject: [PATCH 01/10] Check for generic structs in blittability tests --- src/coreclr/vm/dllimport.cpp | 3 ++ .../UnmanagedCallersOnlyTest.cs | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp index 37aab6a3f530d7..ac578cf99e525b 100644 --- a/src/coreclr/vm/dllimport.cpp +++ b/src/coreclr/vm/dllimport.cpp @@ -3316,8 +3316,11 @@ BOOL NDirect::MarshalingRequired( FALLTHROUGH; case ELEMENT_TYPE_VALUETYPE: + case ELEMENT_TYPE_GENERICINST: { TypeHandle hndArgType = arg.GetTypeHandleThrowing(pModule, &emptyTypeContext); + if(!hndArgType.IsValueType()) + return true; if (hndArgType.GetMethodTable()->IsInt128OrHasInt128Fields()) { diff --git a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs index 2cb66c9294611a..f8f139f8a882e1 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs +++ b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs @@ -37,6 +37,7 @@ public static int Main(string[] args) NegativeTest_FromInstantiatedGenericClass(); TestUnmanagedCallersOnlyViaUnmanagedCalli(); TestPInvokeMarkedWithUnmanagedCallersOnly(); + TestUnmanagedCallersOnlyWithGeneric(); // Exception handling is only supported on CoreCLR Windows. if (TestLibrary.Utilities.IsWindows && !TestLibrary.Utilities.IsMonoRuntime) @@ -217,4 +218,36 @@ public static void TestPInvokeMarkedWithUnmanagedCallersOnly() int n = 1234; Assert.Throws(() => ((delegate* unmanaged)&CallingUnmanagedCallersOnlyDirectly.PInvokeMarkedWithUnmanagedCallersOnly)(n)); } + + public static void TestUnmanagedCallersOnlyWithGeneric() + { + Assert.Equal(0, ((delegate* unmanaged, int>)&BlittableGeneric)(new Blittable())); + + Assert.Equal(0, ((delegate* unmanaged, int>)&MaybeBlittableGeneric)(new MaybeBlittable())); + + // Assert.Throws(() => ((delegate* unmanaged>, int>)&NonBlittableGeneric)(new MaybeBlittable>())); + + // Assert.Throws(() => ((delegate* unmanaged, int>)&GenericObject)(new NonBlittable())); + } + + internal struct Blittable where T : unmanaged + { + T Value; + } + + internal struct MaybeBlittable + { + T Value; + } + + internal class NonBlittable where T: unmanaged + { + T Value; + } + + [UnmanagedCallersOnly] + internal static int BlittableGeneric(Blittable param) => 0; + + [UnmanagedCallersOnly] + internal static int MaybeBlittableGeneric(MaybeBlittable param) => 0; } From 7584e6ebb53f7f993b44e97462a7633ffb589033 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:22:11 -0700 Subject: [PATCH 02/10] Remove Unused and commented code --- .../UnmanagedCallersOnlyTest.cs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs index f8f139f8a882e1..49cf277e040e60 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs +++ b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs @@ -221,13 +221,9 @@ public static void TestPInvokeMarkedWithUnmanagedCallersOnly() public static void TestUnmanagedCallersOnlyWithGeneric() { - Assert.Equal(0, ((delegate* unmanaged, int>)&BlittableGeneric)(new Blittable())); + Assert.Equal(0, ((delegate* unmanaged, int>)&BlittableGenericStruct)(new Blittable())); - Assert.Equal(0, ((delegate* unmanaged, int>)&MaybeBlittableGeneric)(new MaybeBlittable())); - - // Assert.Throws(() => ((delegate* unmanaged>, int>)&NonBlittableGeneric)(new MaybeBlittable>())); - - // Assert.Throws(() => ((delegate* unmanaged, int>)&GenericObject)(new NonBlittable())); + Assert.Equal(0, ((delegate* unmanaged, int>)&MaybeBlittableGenericStruct)(new MaybeBlittable())); } internal struct Blittable where T : unmanaged @@ -240,14 +236,9 @@ internal struct MaybeBlittable T Value; } - internal class NonBlittable where T: unmanaged - { - T Value; - } - [UnmanagedCallersOnly] - internal static int BlittableGeneric(Blittable param) => 0; + internal static int BlittableGenericStruct(Blittable param) => 0; [UnmanagedCallersOnly] - internal static int MaybeBlittableGeneric(MaybeBlittable param) => 0; + internal static int MaybeBlittableGenericStruct(MaybeBlittable param) => 0; } From 6825ffee0f80a6700ce30d7e59b045ec645077db Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Mon, 21 Aug 2023 12:43:20 -0700 Subject: [PATCH 03/10] Add test in ilproj --- .../UnmanagedCallersOnly/InvalidCallbacks.il | 74 ++++++++++++++++++- .../UnmanagedCallersOnlyTest.cs | 8 +- 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il b/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il index 4c7826650dcb82..04a7faa5ad2cb8 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il +++ b/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il @@ -240,4 +240,76 @@ call instance void [System.Runtime]System.Object::.ctor() ret } -} \ No newline at end of file +} + +.class public sequential ansi sealed beforefieldinit InvalidCSharp.MaybeBlittable`1 + extends [System.Runtime]System.ValueType +{ + // Fields + .field private !T Value +} + +.class public auto ansi sealed beforefieldinit InvalidCSharp.NotBlittable`1 + extends [System.Runtime]System.Object +{ + // Fields + .field private !T Value + // Methods + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed + { + // Method begins at RVA 0x20a0 + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [System.Runtime]System.Object::.ctor() + IL_0006: ret + } +} + +.class public auto ansi beforefieldinit InvalidCSharp.InvalidGenericUnmanagedCallersOnlyParameters + extends [System.Runtime]System.Object +{ + .method public hidebysig specialname rtspecialname + instance void .ctor () cil managed + { + .maxstack 8 + ldarg.0 + call instance void [System.Runtime]System.Object::.ctor() + ret + } + + .method public hidebysig static + int32 GenericClass ( + class InvalidCSharp.NotBlittable`1 param + ) cil managed + { + .custom instance void [System.Runtime.InteropServices]System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x24c4 + // Header size: 1 + // Code size: 2 (0x2) + .maxstack 8 + + IL_0000: ldc.i4.0 + IL_0001: ret + } + + .method public hidebysig static + int32 GenericStructWithObjectField ( + valuetype InvalidCSharp.MaybeBlittable`1 param + ) cil managed + { + .custom instance void [System.Runtime.InteropServices]System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute::.ctor() = ( + 01 00 00 00 + ) + // Method begins at RVA 0x24c4 + // Header size: 1 + // Code size: 2 (0x2) + .maxstack 8 + + IL_0000: ldc.i4.0 + IL_0001: ret + } +} diff --git a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs index 49cf277e040e60..e8c9f610c20708 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs +++ b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs @@ -224,6 +224,10 @@ public static void TestUnmanagedCallersOnlyWithGeneric() Assert.Equal(0, ((delegate* unmanaged, int>)&BlittableGenericStruct)(new Blittable())); Assert.Equal(0, ((delegate* unmanaged, int>)&MaybeBlittableGenericStruct)(new MaybeBlittable())); + + Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericClass)(new NotBlittable())); + + Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericStructWithObjectField)(new MaybeBlittable())); } internal struct Blittable where T : unmanaged @@ -231,10 +235,6 @@ internal struct Blittable where T : unmanaged T Value; } - internal struct MaybeBlittable - { - T Value; - } [UnmanagedCallersOnly] internal static int BlittableGenericStruct(Blittable param) => 0; From 26d49b41d84fbc875ec8e3fa1395fc22eec80d77 Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Wed, 23 Aug 2023 20:07:50 +0000 Subject: [PATCH 04/10] Use correct expected exception --- .../Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs index e8c9f610c20708..f33a07e9cd7a24 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs +++ b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs @@ -225,9 +225,9 @@ public static void TestUnmanagedCallersOnlyWithGeneric() Assert.Equal(0, ((delegate* unmanaged, int>)&MaybeBlittableGenericStruct)(new MaybeBlittable())); - Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericClass)(new NotBlittable())); + Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericClass)(new NotBlittable())); - Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericStructWithObjectField)(new MaybeBlittable())); + Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericStructWithObjectField)(new MaybeBlittable())); } internal struct Blittable where T : unmanaged From 9e2e439c4ee5135b7464d4b4efb6fabae95c5220 Mon Sep 17 00:00:00 2001 From: Jackson Schuster Date: Thu, 24 Aug 2023 19:17:13 +0000 Subject: [PATCH 05/10] update test --- .../UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs index f33a07e9cd7a24..ac89fdfe24aee6 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs +++ b/src/tests/Interop/UnmanagedCallersOnly/UnmanagedCallersOnlyTest.cs @@ -225,9 +225,12 @@ public static void TestUnmanagedCallersOnlyWithGeneric() Assert.Equal(0, ((delegate* unmanaged, int>)&MaybeBlittableGenericStruct)(new MaybeBlittable())); - Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericClass)(new NotBlittable())); - Assert.Throws (() => ((delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericStructWithObjectField)(new MaybeBlittable())); + Assert.Throws(() + => ((delegate* unmanaged)(void*)(delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericClass)((nint)1)); + + Assert.Throws(() + => ((delegate* unmanaged)(void*)(delegate* unmanaged, int>)&InvalidGenericUnmanagedCallersOnlyParameters.GenericStructWithObjectField)((nint)1)); } internal struct Blittable where T : unmanaged From b3253eacbec5c5e738d5731b5c03f588ddd66b15 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:09:58 -0700 Subject: [PATCH 06/10] Apply suggestions from code review Co-authored-by: Aaron Robinson --- .../Interop/UnmanagedCallersOnly/InvalidCallbacks.il | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il b/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il index 04a7faa5ad2cb8..7090382368e3b7 100644 --- a/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il +++ b/src/tests/Interop/UnmanagedCallersOnly/InvalidCallbacks.il @@ -258,8 +258,6 @@ .method public hidebysig specialname rtspecialname instance void .ctor () cil managed { - // Method begins at RVA 0x20a0 - // Code size 7 (0x7) .maxstack 8 IL_0000: ldarg.0 IL_0001: call instance void [System.Runtime]System.Object::.ctor() @@ -287,9 +285,6 @@ .custom instance void [System.Runtime.InteropServices]System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute::.ctor() = ( 01 00 00 00 ) - // Method begins at RVA 0x24c4 - // Header size: 1 - // Code size: 2 (0x2) .maxstack 8 IL_0000: ldc.i4.0 @@ -304,9 +299,6 @@ .custom instance void [System.Runtime.InteropServices]System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute::.ctor() = ( 01 00 00 00 ) - // Method begins at RVA 0x24c4 - // Header size: 1 - // Code size: 2 (0x2) .maxstack 8 IL_0000: ldc.i4.0 From 18f77b75f3f7c5af986bfeaf05a4dadc32f26c13 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:09:26 -0700 Subject: [PATCH 07/10] wip --- src/coreclr/vm/dllimport.cpp | 3 +- src/coreclr/vm/mlinfo.cpp | 64 ++++++++++++++++++------------------ src/coreclr/vm/mlinfo.h | 1 + 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp index ac578cf99e525b..ab5492bc9ee7b7 100644 --- a/src/coreclr/vm/dllimport.cpp +++ b/src/coreclr/vm/dllimport.cpp @@ -3319,7 +3319,8 @@ BOOL NDirect::MarshalingRequired( case ELEMENT_TYPE_GENERICINST: { TypeHandle hndArgType = arg.GetTypeHandleThrowing(pModule, &emptyTypeContext); - if(!hndArgType.IsValueType()) + bool isValidGeneric = !IsValidForGenericMarshalling( hndArgType.AsMethodTable(), false, runtimeMarshallingEnabled)); + if(!hndArgType.IsValueType() || isValidGeneric) return true; if (hndArgType.GetMethodTable()->IsInt128OrHasInt128Fields()) diff --git a/src/coreclr/vm/mlinfo.cpp b/src/coreclr/vm/mlinfo.cpp index 8d23d5d5ac597e..3a5c0e0cbfd228 100644 --- a/src/coreclr/vm/mlinfo.cpp +++ b/src/coreclr/vm/mlinfo.cpp @@ -1067,43 +1067,43 @@ OleColorMarshalingInfo *EEMarshalingData::GetOleColorMarshalingInfo() } #endif // FEATURE_COMINTEROP -namespace +bool IsValidForGenericMarshalling(MethodTable* pMT, bool isFieldScenario, bool builtInMarshallingEnabled = true) { - bool IsValidForGenericMarshalling(MethodTable* pMT, bool isFieldScenario, bool builtInMarshallingEnabled = true) - { - _ASSERTE(pMT != NULL); + _ASSERTE(pMT != NULL); - // Not generic, so passes "generic" test - if (!pMT->HasInstantiation()) - return true; + // Not generic, so passes "generic" test + if (!pMT->HasInstantiation()) + return true; - // We can't block generic types for field scenarios for back-compat reasons. - if (isFieldScenario) - return true; + // We can't block generic types for field scenarios for back-compat reasons. + if (isFieldScenario) + return true; - // Built-in marshalling considers the blittability for a generic type. - if (builtInMarshallingEnabled && !pMT->IsBlittable()) - return false; - - // Generics (blittable when built-in is enabled) are allowed to be marshalled with the following exceptions: - // * Nullable: We don't want to be locked into the default behavior as we may want special handling later - // * Span: Not supported by built-in marshalling - // * ReadOnlySpan: Not supported by built-in marshalling - // * Vector64: Represents the __m64 ABI primitive which requires currently unimplemented handling - // * Vector128: Represents the __m128 ABI primitive which requires currently unimplemented handling - // * Vector256: Represents the __m256 ABI primitive which requires currently unimplemented handling - // * Vector512: Represents the __m512 ABI primitive which requires currently unimplemented handling - // * Vector: Has a variable size (either __m128 or __m256) and isn't readily usable for interop scenarios - return !pMT->HasSameTypeDefAs(g_pNullableClass) - && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__SPAN)) - && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__READONLY_SPAN)) - && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR64T)) - && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR128T)) - && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR256T)) - && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR512T)) - && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTORT)); - } + // Built-in marshalling considers the blittability for a generic type. + if (builtInMarshallingEnabled && !pMT->IsBlittable()) + return false; + + // Generics (blittable when built-in is enabled) are allowed to be marshalled with the following exceptions: + // * Nullable: We don't want to be locked into the default behavior as we may want special handling later + // * Span: Not supported by built-in marshalling + // * ReadOnlySpan: Not supported by built-in marshalling + // * Vector64: Represents the __m64 ABI primitive which requires currently unimplemented handling + // * Vector128: Represents the __m128 ABI primitive which requires currently unimplemented handling + // * Vector256: Represents the __m256 ABI primitive which requires currently unimplemented handling + // * Vector512: Represents the __m512 ABI primitive which requires currently unimplemented handling + // * Vector: Has a variable size (either __m128 or __m256) and isn't readily usable for interop scenarios + return !pMT->HasSameTypeDefAs(g_pNullableClass) + && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__SPAN)) + && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__READONLY_SPAN)) + && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR64T)) + && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR128T)) + && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR256T)) + && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR512T)) + && !pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTORT)); +} +namespace +{ MarshalInfo::MarshalType GetDisabledMarshallerType( Module* pModule, SigPointer sig, diff --git a/src/coreclr/vm/mlinfo.h b/src/coreclr/vm/mlinfo.h index 326c31c8ba465d..aefcdf3396d312 100644 --- a/src/coreclr/vm/mlinfo.h +++ b/src/coreclr/vm/mlinfo.h @@ -287,6 +287,7 @@ class EEMarshalingData struct ItfMarshalInfo; +bool IsValidForGenericMarshalling(MethodTable* pMT, bool isFieldScenario, bool builtInMarshallingEnabled = true); class MarshalInfo { public: From 8e66f372d1bb05a287f2047831eaccdb890ccadf Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:03:54 -0700 Subject: [PATCH 08/10] Update src/coreclr/vm/dllimport.cpp Co-authored-by: Jeremy Koritzinsky --- src/coreclr/vm/dllimport.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp index ab5492bc9ee7b7..5a9ef393d3e775 100644 --- a/src/coreclr/vm/dllimport.cpp +++ b/src/coreclr/vm/dllimport.cpp @@ -3319,8 +3319,8 @@ BOOL NDirect::MarshalingRequired( case ELEMENT_TYPE_GENERICINST: { TypeHandle hndArgType = arg.GetTypeHandleThrowing(pModule, &emptyTypeContext); - bool isValidGeneric = !IsValidForGenericMarshalling( hndArgType.AsMethodTable(), false, runtimeMarshallingEnabled)); - if(!hndArgType.IsValueType() || isValidGeneric) + bool isValidGeneric = IsValidForGenericMarshalling( hndArgType.GetMethodTable(), false, runtimeMarshallingEnabled)); + if(!hndArgType.IsValueType() || !isValidGeneric) return true; if (hndArgType.GetMethodTable()->IsInt128OrHasInt128Fields()) From 0371807fb9927efabd84c7e92c277486cd38fab0 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:06:30 -0700 Subject: [PATCH 09/10] Fix typo --- src/coreclr/vm/dllimport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp index 5a9ef393d3e775..c0f90289a01682 100644 --- a/src/coreclr/vm/dllimport.cpp +++ b/src/coreclr/vm/dllimport.cpp @@ -3319,7 +3319,7 @@ BOOL NDirect::MarshalingRequired( case ELEMENT_TYPE_GENERICINST: { TypeHandle hndArgType = arg.GetTypeHandleThrowing(pModule, &emptyTypeContext); - bool isValidGeneric = IsValidForGenericMarshalling( hndArgType.GetMethodTable(), false, runtimeMarshallingEnabled)); + bool isValidGeneric = IsValidForGenericMarshalling(hndArgType.GetMethodTable(), false, runtimeMarshallingEnabled); if(!hndArgType.IsValueType() || !isValidGeneric) return true; From 9e3564be72e6497ecb97bacd73bb7b1a265f8902 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:24:35 -0700 Subject: [PATCH 10/10] Don't redefine default param --- src/coreclr/vm/mlinfo.cpp | 2 +- src/coreclr/vm/mlinfo.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coreclr/vm/mlinfo.cpp b/src/coreclr/vm/mlinfo.cpp index 3a5c0e0cbfd228..8e50860a73bffa 100644 --- a/src/coreclr/vm/mlinfo.cpp +++ b/src/coreclr/vm/mlinfo.cpp @@ -1067,7 +1067,7 @@ OleColorMarshalingInfo *EEMarshalingData::GetOleColorMarshalingInfo() } #endif // FEATURE_COMINTEROP -bool IsValidForGenericMarshalling(MethodTable* pMT, bool isFieldScenario, bool builtInMarshallingEnabled = true) +bool IsValidForGenericMarshalling(MethodTable* pMT, bool isFieldScenario, bool builtInMarshallingEnabled) { _ASSERTE(pMT != NULL); diff --git a/src/coreclr/vm/mlinfo.h b/src/coreclr/vm/mlinfo.h index aefcdf3396d312..93a0f554d30af4 100644 --- a/src/coreclr/vm/mlinfo.h +++ b/src/coreclr/vm/mlinfo.h @@ -288,6 +288,7 @@ class EEMarshalingData struct ItfMarshalInfo; bool IsValidForGenericMarshalling(MethodTable* pMT, bool isFieldScenario, bool builtInMarshallingEnabled = true); + class MarshalInfo { public: