- Home /
Internal Compiler Error #3 (ILGenerator Emit Issue)
I am getting an Internal Compiler Error. The research I have done so far on this one points to the only solution being to upgrade the Mono system to a newer version. Since this is Unity 4.0 I don't know how I can possibly do that and even if Unity will upgrade any time soon. What do I do about that?
Here is the error:
Internal compiler error. See the console log for more information. output was:
Unhandled Exception: System.ArgumentException: Trying to emit a local from a different ILGenerator.
at System.Reflection.Emit.ILGenerator.Emit (OpCode opcode, System.Reflection.Emit.LocalBuilder local) [0x00000] in <filename unknown>:0
at Mono.CSharp.LocalTemporary.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.MemberExpr.EmitInstance (Mono.CSharp.EmitContext ec, Boolean prepare_for_load) [0x00000] in <filename unknown>:0
at Mono.CSharp.FieldExpr.Emit (Mono.CSharp.EmitContext ec, Boolean leave_copy) [0x00000] in <filename unknown>:0
at Mono.CSharp.HoistedVariable.Emit (Mono.CSharp.EmitContext ec, Boolean leave_copy) [0x00000] in <filename unknown>:0
at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec, Boolean leave_copy) [0x00000] in <filename unknown>:0
at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Arguments.Emit (Mono.CSharp.EmitContext ec, Boolean dup_args, Mono.CSharp.LocalTemporary this_arg) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method, Mono.CSharp.Arguments Arguments, Location loc, Boolean dup_args, Boolean omit_args) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method, Mono.CSharp.Arguments Arguments, Location loc) [0x00000] in <filename unknown>:0
at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec, Mono.CSharp.Arguments arguments) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.EmitStatement (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.ExplicitBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.ToplevelBlock.Emit (Mono.CSharp.EmitContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000] in <filename unknown>:0
at Mono.CSharp.AbstractPropertyEventMethod.Emit (Mono.CSharp.DeclSpace parent) [0x00000] in <filename unknown>:0
at Mono.CSharp.Event.Emit () [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeContainer.EmitType () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootContext.EmitCode () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Unless the "console log" is already telling you, I would suggest trying to isolate what part of your code is causing the error by gradually removing stuff. Once you locate the code, try changing the algorithm, moving things around, into functions, etc. Ugly to be sure, but there's a reason we have the word "workaround". And, report it as a bug.
Thank you for the reply and suggestion.
Sadly this is not working well because the code is so very intertwined I can't seem to remove stuff without causing other errors that then hide this error.
@Dave In 21st century removing stuff to find out what causing error is neanderthal philosophy. This unavoidable stellar tactic is also often used with Unity GUI. Shame!.
Well then @winxalex, you can move on to using your 100% perfect, bug free 21st century tools while the rest of us live in reality.
@Dave Carllie F that reality where top IDE are nothing more then fancy intelli texteditors and tools that shows 100s useless error lines so you need to remove lines one by one to find out what is wrong. 1000 of useless waiting hrs for editor compiler code, then player compiler code to find out that you have done supid error and in order to fix it, u need to recompile everything. It up to you to fight for Live coding or to keep using Punched cards.
Answer by Hotshot10101 · Apr 17, 2013 at 01:41 PM
From everything I can tell these Internal Compiler errors happen when I try to include a .dll file that requires .NET functionality that is higher than 2.0 and part of the bleeding edge stuff included in Unity's mono. That is probably why it is called bleeding edge, eh?
Anyway, the answer is just trial and error. Some newer .NET stuff works and some just doesn't even though it is included and supposedly "in there".
Answer by winxalex · Jul 01, 2015 at 01:10 PM
//this.channels.ForEach (chn => chn.nodes.ForEach (nd => nd.onStart.AddListener(value)));<-- this cause same error.
//solution
foreach(SequenceChannel channel in this.channels)
foreach(SequenceNode node in channel.nodes)
node.onStart.AddListener(value);
}
It is obvious that many stuff in Mono towards .NET are underdeveloped.
Answer by Kurius · Nov 30, 2016 at 10:50 PM
I had what seemed to be several warnings appearing as errors! When I scrolled down through the warnings, I noticed there truly was an error listed at the very end.
ERROR... "Unhandled Exception: System.ArgumentException: Trying to emit a local from a different ILGenerator"
CAUSE... The error occurred because I had just put a TRY CATCH statement inside a COROUTINE. Unity doesn't like that!
SOLUTION... I resolved the error be removing all Try Catch statements from all Coroutines.
Your answer
Follow this Question
Related Questions
error CS0016 - Access to the path is denied 1 Answer
Internal Compiler Error 1 Answer
Another Internal Compiler Error 2 Answers
Warning messages are turning into Internal Compiler Errors...? 6 Answers
Internal Compiler Error again 1 Answer