diff --git a/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorTest.cs b/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorTest.cs index 764e79006886a8..31f64bb6b4e692 100644 --- a/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorTest.cs +++ b/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorTest.cs @@ -26,12 +26,9 @@ public static unsafe int StructWithCtorTest(StructWithCtor* ptrStruct, ref Struc return 100; } - [UnmanagedFunctionPointerAttribute(CallingConvention.StdCall)] - public delegate int TestDelegate(StructWithCtor* ptrStruct, ref StructWithCtor refStruct); - public static unsafe int Main() { - TestDelegate del = (TestDelegate)StructWithCtorTest; + TestDelegate del = (TestDelegate)Delegate.CreateDelegate(typeof(TestDelegate), typeof(CopyCtor).GetMethod("StructWithCtorTest")); StructWithCtor s1 = new StructWithCtor(); StructWithCtor s2 = new StructWithCtor(); s1._instanceField = 1; diff --git a/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorUtil.il b/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorUtil.il index d77a1eec69e526..495bcf7d34a95f 100644 --- a/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorUtil.il +++ b/src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorUtil.il @@ -5,6 +5,39 @@ .assembly extern System.Runtime.CompilerServices.VisualC { } .assembly CopyCtorUtil { } +.class auto ansi sealed public TestDelegate + extends [mscorlib]System.MulticastDelegate +{ + .custom instance void [mscorlib]System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute::.ctor(valuetype [mscorlib]System.Runtime.InteropServices.CallingConvention) = ( 01 00 03 00 00 00 00 00 ) + .method public hidebysig specialname rtspecialname + instance void .ctor(object 'object', + native int 'method') runtime managed + { + } // end of method TestDelegate::.ctor + + .method public hidebysig newslot virtual + instance int32 Invoke(valuetype [CopyCtorUtil]StructWithCtor modreq([mscorlib]System.Runtime.CompilerServices.IsCopyConstructed)* ptrStruct, + valuetype [CopyCtorUtil]StructWithCtor modreq([mscorlib]System.Runtime.CompilerServices.IsCopyConstructed)& refStruct) runtime managed + { + } // end of method TestDelegate::Invoke + + .method public hidebysig newslot virtual + instance class [mscorlib]System.IAsyncResult + BeginInvoke(valuetype [CopyCtorUtil]StructWithCtor modreq([mscorlib]System.Runtime.CompilerServices.IsCopyConstructed)* ptrStruct, + valuetype [CopyCtorUtil]StructWithCtor modreq([mscorlib]System.Runtime.CompilerServices.IsCopyConstructed)& refStruct, + class [mscorlib]System.AsyncCallback callback, + object 'object') runtime managed + { + } // end of method TestDelegate::BeginInvoke + + .method public hidebysig newslot virtual + instance int32 EndInvoke(valuetype [CopyCtorUtil]StructWithCtor modreq([mscorlib]System.Runtime.CompilerServices.IsCopyConstructed)& refStruct, + class [mscorlib]System.IAsyncResult result) runtime managed + { + } // end of method TestDelegate::EndInvoke + +} // end of class TestDelegate + .class public sealed sequential ansi beforefieldinit StructWithCtor extends [mscorlib]System.ValueType {