Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Unhandled Exception: ILCompiler.CodeGenerationFailedException: Code generation failed for method #8346

Open
Powerlated opened this issue Sep 21, 2020 · 2 comments

Comments

@Powerlated
Copy link

Unhandled Exception: Unhandled Exception: Unhandled Exception: Unhandled Exception: Unhandled Exception: Unhandled Exception: Unhandled Exception: Unhandled Exception: Unhandled Exception:
  Unhandled Exception:
  Unhandled Exception:
  Unhandled Exception: ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(int32,ShaderType,string&,int32[])'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
  ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(uint32,ShaderType,string&,int32&)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
  ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(int32,ShaderType,string&,int32*)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
  ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(int32,All,string&,int32[])'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
  ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(uint32,ShaderType,string&,int32[])'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
  ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(int32,All,string&,int32*)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()
  ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(uint32,All,string&,int32&)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(uint32,All,string&,int32*)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(uint32,ShaderType,string&,int32*)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(int32,ShaderType,string&,int32&)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(uint32,All,string&,int32[])'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()ILCompiler.CodeGenerationFailedException: Code generation failed for method '[OpenTK]OpenTK.Graphics.ES30.GL+Qcom.ExtGetProgramBinarySource(int32,All,string&,int32&)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location where exception was thrown ---
     at System.Threading.ThreadPoolWorkQueue.Dispatch()

I am attempting to dotnet publish -r win-x64 -c Release a program and I receieve this error after the Generating compatible native code. message.

@jkotas
Copy link
Member

jkotas commented Sep 22, 2020

OpenTK assembly contains invalid IL:

    .method public hidebysig static void 
            ExtGetProgramBinarySource(int32 program,
                                      valuetype OpenTK.Graphics.ES30.All shadertype,
                                      [out] string& source,
                                      [out] int32[] length) cil managed
    {
      .maxstack  7
      .locals init (native int V_0,
               int32 V_1,
               int32& pinned V_2)
      IL_0000:  ldarg.0
      IL_0001:  ldarg.1
      IL_0002:  ldarg.2
      IL_0003:  pop
      IL_0004:  ldarg.3 <- the type of 3rd argument is `int32[]`
      IL_0005:  ldind.i4 <- ldind.i4 on `int32[]` is invalid IL operation
...

(This is just one example. There are more.)

It is crashing the JIT with CORJIT_INTERNALERROR and in turn crashing the compiler.

@jkotas
Copy link
Member

jkotas commented Sep 22, 2020

OpenTK project is using IL generator https://github.com/opentk/opentk/tree/master/src/Generator.Rewrite that seems to be responsible for the invalid IL.

We should look into reporting this error in a better way, but the underlying problem should be fixed in OpenTK project. @Powerlated Could you please open an issue on this in OpenTK project?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants