-
Notifications
You must be signed in to change notification settings - Fork 128
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
IL Trimmer: Unhandled exception. System.NotImplementedException: Unhandled intrinsic #3072
Comments
What version are you using ? /cc @vitek-karas |
I think this is 7.0, because I can't find code which would throw such exception in 6. If you have a repro project, that would help a lot. |
I was able to repro this. The problem is with calls to methods like This is fixed in main as a side effect of #3060, but that is not in 7.0. This reproes in 6.0 as well, so at least it's not a 7.0 regression. I can't think of a workaround to this unfortunately (other than changing the implementation of MoonSharp, which is obviously not really workable). |
I'm sorry for failing to provide the version and a repro project originally but I'm glad that it's been figured out and had even already been fixed! :) |
Yup, let's take this for servicing. Unfortunately our servicing schedule for 7.0 is going to be a bit late (month or two after shipping) but it's still better to have it fixed. |
I just upgraded from .net6 to 7 and dotnet publish is now throwing this error. This is a Blazor WASM hosted project. Could it be one of the nuget packages I'm referencing? If so how could I tell? |
Ok so it turns out I was using a deprecated nuget package: Microsoft.Azure.Cosmos.Table |
@nheath99 - as far as I can tell the only way to repro this is if your app uses a component which was built against netstandard1.2 (I think, not sure about the exact version - but something old, netstandard2.0 doesn't have this problem) and uses one of the reflection methods mentioned above. So updating to a newer package is likely to fix the problem - in fact even the exact same code if rebuilt against netstandard2.0 would fix the problem as well. Anyway - glad you were able to get it to work. I'm working on backporting the fix to 6 - the tricky part is to build a test which reproes the problem (building something against old netstandard in our build system seems to be tricky) |
The problem is that GetIntrinsicIdForMethod operates on MethodDefinition but some parts of HandleCall operate on MethodReference. If the calling code references for example TypeInfo.GetMethods intrinsics detection finds this as being the GetMethods intrinsics but HandleCall doesn't and falls through to the default case which should basically never happen. The fix is to use MethodDefinition in both places. Added a test which needed to be done in IL since the last time TypeInfo.GetMethods existed as a method (and not inherited from Type.GetMethods) was in netstandard1.2. So in the IL the call is made to a MethodReference TypeInfo.GetMethods which reproes the problem.
@Saalvage : I don't know if you were ever able to work around this issue - but I had the same issue today with building a I was able to work around it by:
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<ProjectGuid>{49F32476-FCA0-45FD-8F89-0C7C0D15E409}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile328</TargetFrameworkProfile>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\keypair.snk</AssemblyOriginatorKeyFile>
<TargetFrameworks>net6.0</TargetFrameworks>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
OK, for your convenience, here is a repo with the changes to MoonSharp to enable a successful build : https://github.com/baskren/moonsharp/tree/net6.0-ios |
The problem is that GetIntrinsicIdForMethod operates on MethodDefinition but some parts of HandleCall operate on MethodReference. If the calling code references for example TypeInfo.GetMethods intrinsics detection finds this as being the GetMethods intrinsics but HandleCall doesn't and falls through to the default case which should basically never happen. The fix is to use MethodDefinition in both places. Added a test which needed to be done in IL since the last time TypeInfo.GetMethods existed as a method (and not inherited from Type.GetMethods) was in netstandard1.2. So in the IL the call is made to a MethodReference TypeInfo.GetMethods which reproes the problem.
This should be fixed and available in the latest 7.0 patches. |
When trying to use MoonSharp in a Blazor WASM app the following stack trace presents itself on attempted publishing:
If any further info is needed please ask!
The text was updated successfully, but these errors were encountered: