dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.97k stars 4.66k forks source link

[mono] Not implemented: System.Reflection.Emit.DynamicILInfo.SetLocalSignature(Byte[] localSignature) #31857

Open MaximLipnin opened 4 years ago

MaximLipnin commented 4 years ago

Because System.Reflection.Emit.DynamicILInfo.SetLocalSignature(Byte[] localSignature) is not yet implemented on mono, some related tests fail with System.NotImplementedException : The method or operation is not implemented.

Those below are disabled in CoreFX.issues.rsp file, but they will be moved into their respective xUnit tests with ActiveIssue in #2087.

- System.Reflection.Emit.Tests.DynamicILInfoTests.Test_TwoDimTest
- System.Reflection.Emit.Tests.DynamicILInfoTests.Test_GenericMethod
- System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_CtorMethodAndField_Success
- System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_String_Success
- System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_StringGenerics_Success
- System.Reflection.Emit.Tests.DynamicILInfoTests.Test_CallGM
- System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_Exception_Success
- System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_DynamicMethod_Success
lambdageek commented 4 years ago

/cc @alexischr

danmoseley commented 4 years ago

@MaximLipnin for failures like this can you please include a callstack or line number so we can see which method is throwing this? Eg., it might be in corelib rather than ref.emit itself.

MaximLipnin commented 4 years ago
System.Reflection.Emit.Tests.DynamicILInfoTests.Test_TwoDimTest [FAIL]
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(527,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.Test_TwoDimTest()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.Emit.Tests.DynamicILInfoTests.Test_GenericMethod [FAIL]
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(445,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.Test_GenericMethod()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_CtorMethodAndField_Success [FAIL]
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(131,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_CtorMethodAndField_Success()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_String_Success [FAIL]
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(24,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_String_Success()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_StringGenerics_Success [FAIL]
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(267,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_StringGenerics_Success()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.Emit.Tests.DynamicILInfoTests.Test_CallGM [FAIL]
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(599,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.Test_CallGM()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_Exception_Success [FAIL]
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(362,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_Exception_Success()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_DynamicMethod_Success [FAIL]
System.NotImplementedException : The method or operation is not implemented.
Stack Trace:
    _\src\libraries\System.Reflection.Emit.Lightweight\tests\DynamicILInfoTests.cs(57,0): at System.Reflection.Emit.Tests.DynamicILInfoTests.GetTokenFor_DynamicMethod_Success()
    _\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(359,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
MaximLipnin commented 4 years ago

https://github.com/dotnet/runtime/blob/5cd7e970487c4cc9ae652185a2f867159c48c9a0/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILInfo.cs#L132-L136

steveharter commented 4 years ago

Moving from area-System.Reflection.Emit to area-Interop-mono (there is no area-Reflection-mono area).

ionoy commented 3 years ago

LiveSharp uses this API to compile IL instructions into DynamicMethod on .NET Core. I could use IlGenerator, but unfortunately, it's too high-level. Mono is used on Xamarin and Blazor WASM - both major platforms for LiveSharp users.

By the way, is there another way of doing this until the API gets implemented? Maybe via reflection somehow?

Thanks!

SamMonoRT commented 2 years ago

@lambdageek - we have been postponing this, is it worth revisiting?

ivanpovazan commented 1 month ago

@steveisok I won't have capacity to look into this in .NET9.

These tests are disabled for a while, maybe it is worth considering closing the issue as not planned.