Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Use IsCopyConstructed modreq consistently in test #40168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
33 changes: 33 additions & 0 deletions src/tests/Interop/PInvoke/Miscellaneous/CopyCtor/CopyCtorUtil.il
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down