Skip to content

[NativeAOT] System.NotImplementedException: CORINFO_HELP_GETSYNCFROMCLASSHANDLE #77093

@Cyl18

Description

@Cyl18

Description

System.NotImplementedException: CORINFO_HELP_GETSYNCFROMCLASSHANDLE
Code generation failed for method '[GammaLibrary]GammaLibrary.Configuration`1<System.__Canon>.Save()'

Code of Save() is

https://github.com/Cyl18/GammaLibrary/blob/e6f41509f6d526b6647960d65bb09c97a30383d6/GammaLibrary/Configuration.cs#L48

Reproduction Steps

  1. clone https://github.com/TRKS-Team/WFBot/tree/nativeAOT
  2. run build-wfbot-ci.bat

content of build-wfbot-ci.bat:

dotnet publish WFBot -o out/WFBotWindowsS -r win-x86 --self-contained true -c "Linux Release" -p:PublishSingleFile=true -p:PublishReadyToRun=true /p:IncludeNativeLibrariesForSelfExtract=true

Expected behavior

successfully compile

Actual behavior

.NET 6 logs
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error : Error
: One or more errors occurred. (Code generation failed for method '[GammaLibrary]GammaLibrary.Configuration`1<System.__
Canon>.Save()') [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error : Syste
m.AggregateException: One or more errors occurred. (Code generation failed for method '[GammaLibrary]GammaLibrary.Confi
guration`1<System.__Canon>.Save()') [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :  --->
 ILCompiler.CodeGenerationFailedException: Code generation failed for method '[GammaLibrary]GammaLibrary.Configuration`
1<System.__Canon>.Save()' [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :  --->
 System.NotImplementedException: CORINFO_HELP_GETSYNCFROMCLASSHANDLE [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot
.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 Internal.JitInterface.CorInfoImpl.GetHelperFtnUncached(CorInfoHelpFunc ftnNum) [C:\Users\cyl18\Documents\GitHub\WFBot\
WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 Internal.JitInterface.CorInfoImpl.getHelperFtn(CorInfoHelpFunc ftnNum, Void*& ppIndirection) [C:\Users\cyl18\Documents
\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 Internal.JitInterface.CorInfoImpl._getHelperFtn(IntPtr thisHandle, IntPtr* ppException, CorInfoHelpFunc ftnNum, Void**
 ppIndirection) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    --
- End of inner exception stack trace --- [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL) [C:\
Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 Internal.JitInterface.CorInfoImpl.CompileMethod(MethodWithGCInfo methodCodeNodeNeedingCode, Logger logger) [C:\Users\c
yl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 ILCompiler.ReadyToRunCodegenCompilation.<ComputeDependencyNodeDependencies>b__36_0(DependencyNodeCore`1 dependency) [C
:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.<>c__DisplayClass33_0`2.<ForEachWorker>b__0(Int32 i) [C:\Users\cyl18\Documents\GitHub\
WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boo
lean& replicationDelegateYieldedBeforeCompletion) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error : --- E
nd of stack trace from previous location --- [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boo
lean& replicationDelegateYieldedBeforeCompletion) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.TaskReplicator.Replica.Execute() [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    --
- End of inner exception stack trace --- [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean st
opOnFirstFailure) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOpti
ons, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) [C:\Users\cy
l18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error : --- E
nd of stack trace from previous location --- [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationT
oken cancelToken, Exception otherException) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOpti
ons, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) [C:\Users\cy
l18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1
body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything,
Func`1 localInit, Action`1 localFinally) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, A
ction`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEver
ything, Func`1 localInit, Action`1 localFinally) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body)
 [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 ILCompiler.ReadyToRunCodegenCompilation.ComputeDependencyNodeDependencies(List`1 obj) [C:\Users\cyl18\Documents\GitHub
\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() [C:\Users\cyl18\Documents\GitHub\WFBo
t\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.
csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String
compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext t
ypeSystemContext) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 ILCompiler.Program.Run(String[] args) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(464,5): error :    at
 ILCompiler.Program.Main(String[] args) [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
.NET 7 logs
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(465,5):
 error : Error: One or more errors occurred. (Code generation failed for method '[WFBot]WFBot.Utils.Configuration`1<Sys
tem.__Canon>.get_Instance()') [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(465,5):
 error : System.AggregateException: One or more errors occurred. (Code generation failed for method '[WFBot]WFBot.Utils
.Configuration`1<System.__Canon>.get_Instance()') [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(465,5):
 error :  ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[WFBot]WFBot.Utils.Configur
ation`1<System.__Canon>.get_Instance()' [C:\Users\cyl18\Documents\GitHub\WFBot\WFBot\WFBot.csproj]
C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.CrossGen.targets(465,5):
 error :  ---> System.NotImplementedException: CORINFO_HELP_GETSYNCFROMCLASSHANDLE [C:\Users\cyl18\Documents\GitHub\WFB
ot\WFBot\WFBot.csproj]

Regression?

No response

Known Workarounds

#77093 (comment)

Configuration

.NET 6 on windows
tried .NET 7, won't work

Other information

maybe #68278 is related to this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions