Skip to content

Referencing OpenTK.Mathematics crashes the Ready2Run build. #56971

@ChrisKoebke

Description

@ChrisKoebke

Description

When referencing OpenTK.Mathematics (or OpenTK.Windowing.Desktop), I'm getting a NotImplementedException on a Ready2Run publish and the build fails.

Demo project for reproduction:

ConsoleApp1.zip

Steps to reproduce the problem:

  • Publish the demo project with the following settings:
    settings

Configuration

  • .NET 6
  • Windows 10
  • Architecture: x64

Other information

2>ConsoleApp1 -> C:\Users\Win10 Home x64\source\repos\ConsoleApp1\ConsoleApp1\bin\Release\net6.0\win-x64\ConsoleApp1.dll
2>Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
2>C:\Users\Win10 Home x64.nuget\packages\microsoft.netcore.app.crossgen2.win-x64\6.0.0-preview.6.21352.12\tools\crossgen2.exe --targetos:windows
2>--targetarch:x64
2>-O
2>-r:"obj\Release\net6.0\win-x64\linked\OpenTK.Mathematics.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\ConsoleApp1.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Collections.Immutable.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Collections.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.ComponentModel.Primitives.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.ComponentModel.TypeConverter.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Console.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Diagnostics.StackTrace.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Drawing.Primitives.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Drawing.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.IO.Compression.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.IO.MemoryMappedFiles.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.ObjectModel.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Private.CoreLib.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Private.Xml.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Reflection.Metadata.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Runtime.CompilerServices.Unsafe.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Runtime.Extensions.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Runtime.InteropServices.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Runtime.Intrinsics.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Runtime.dll"
2>-r:"obj\Release\net6.0\win-x64\linked\System.Xml.ReaderWriter.dll"
2>--out:"obj\Release\net6.0\win-x64\R2R\OpenTK.Mathematics.dll"
2>obj\Release\net6.0\win-x64\linked\OpenTK.Mathematics.dll
2>
2>Error: The method or operation is not implemented.
2>System.NotImplementedException: The method or operation is not implemented.
2> at Internal.TypeSystem.Ecma.EcmaModule.GetType(String nameSpace, String name, NotFoundBehavior notFoundBehavior) in ILCompiler.TypeSystem.ReadyToRun.dll:token 0x6000573+0x145
2> at Internal.TypeSystem.Ecma.EcmaModule.ResolveTypeReference(TypeReferenceHandle handle) in ILCompiler.TypeSystem.ReadyToRun.dll:token 0x600057c+0x2e
2> at Internal.TypeSystem.Ecma.EcmaModule.EcmaObjectLookupHashtable.CreateValueFromKey(EntityHandle handle) in ILCompiler.TypeSystem.ReadyToRun.dll:token 0x60006d6+0x131
2> at Internal.TypeSystem.LockFreeReaderHashtable2.CreateValueAndEnsureValueIsInTable(TKey key) in ILCompiler.TypeSystem.ReadyToRun.dll:token 0x60003ba+0x0 2> at Internal.TypeSystem.Ecma.EcmaModule.GetObject(EntityHandle handle, NotFoundBehavior notFoundBehavior) in ILCompiler.TypeSystem.ReadyToRun.dll:token 0x6000577+0x0 2> at Internal.TypeSystem.Ecma.EcmaModule.GetType(EntityHandle handle) in ILCompiler.TypeSystem.ReadyToRun.dll:token 0x6000574+0x0 2> at ILCompiler.ReadyToRunCompilationModuleGroupBase.TryGetModuleTokenForExternalType(TypeDesc type, ModuleToken& token) in ILCompiler.ReadyToRun.dll:token 0x60000d4+0x51 2> at ILCompiler.DependencyAnalysis.ReadyToRun.ModuleTokenResolver.GetModuleTokenForType(EcmaType type, Boolean throwIfNotFound) in ILCompiler.ReadyToRun.dll:token 0x60005af+0x3c 2> at ILCompiler.DependencyAnalysis.ReadyToRun.SignatureContext.GetTargetModule(TypeDesc type) in ILCompiler.ReadyToRun.dll:token 0x600061e+0x35 2> at ILCompiler.DependencyAnalysis.ReadyToRun.TypeFixupSignature.GetData(NodeFactory factory, Boolean relocsOnly) in ILCompiler.ReadyToRun.dll:token 0x600065c+0x9 2> at ILCompiler.DependencyAnalysis.ReadyToRunObjectWriter.EmitPortableExecutable() in ILCompiler.ReadyToRun.dll:token 0x6000323+0x174 2> at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) in ILCompiler.ReadyToRun.dll:token 0x600012f+0x35 2> at ILCompiler.Program.RunSingleCompilation(Dictionary2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary2 unrootedInputFilePaths, HashSet1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext) in crossgen2.dll:token 0x600015a+0x5e7
2> at ILCompiler.Program.Run(String[] args) in crossgen2.dll:token 0x6000159+0x52e
2> at ILCompiler.Program.Main(String[] args) in crossgen2.dll:token 0x6000161+0x5

I'm assuming it's this line right here:

throw new NotImplementedException();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions