- Home /
Warning messages are turning into Internal Compiler Errors...?
As the title states, warning messages are turning into internal compiler errors. These all used to just be warnings (the little yellow "yield sign" looking thing, that doesn't actually prevent running of the game), but are now (one by one) turning into internal compiler errors.
Here's an example:
Internal compiler error. See the console log for more information.
output was:Assets/MyStuff/myScripts/System Scripts/SaveManager.cs(444,40): warning CS0219: The variable `s' is assigned but its value is never used
Assets/MyStuff/myScripts/System Scripts/SaveManager.cs(456,32): warning CS0219: The variable `s1' is assigned but its value is never used
Assets/MyStuff/myScripts/System Scripts/SaveManager.cs(488,38): warning CS0219: The variable `encoding' is assigned but its value is never used
I understand what the issue is, but it shouldn't be causing an error, and preventing me from testing the game. The biggest problem is that there's dozens of these things, and I get the feeling that the fact that they're all of a sudden deciding to be worthy of stopping the testing process, that there might be a bigger issue, here.
If you couldn't tell by the errors, here, I'm using almost exclusively c#, so it's not just that I've used #pragma strict
, or something. Frankly, I don't have the foggiest idea what's going on, so any insight into how I could stop this would be vastly appreciated. Thank you!
[Edit], Also, if you want more of the error log, I can post it in a comment, I just don't have the time to sift through it and take out any information that might reveal anything sensetive about the game, and I don't want to discourage people.
Only warnings? $$anonymous$$aybe there is a real error among them.
Anyway, try to fix all warnings (looking at the one you posted, this should be fixed by commenting the corresponding lines).
I've had similar issues with unused exception variable within try/catch statement causing these internal compiler error. They're easy to fix but I can't figure why they occur in the first place. As far as I remember, I wasn't doing anything fancy - it just decided not using my variable was a terrible error. I'd like to hear about the actual cause, too.
The strangest part was that many of these warnings had been around for weeks... $$anonymous$$any of which were in files I haven't opened or edited, or edited files that they were dependent on... I even tried re-downloading and re-installing Unity... so whatever it is, it's in the project folder. When I get home, today, I'll try going into another scene, to see if there's just some sort of corruption, there.
Never$$anonymous$$d... false alarm ): tried reimporting all assets, and it looked like it worked, but... alas, it did not... sigh
Now i too got the same error. Reimporting all the assets will solves this issue?
Internal compiler error. See the console log for more information. output was
Answer by DESTRUKTORR · Aug 14, 2012 at 09:31 PM
Ok, NOW I figured out what it was... Apparently it was listing all the warnings in the same message as the actual error, which was aaaall the way at the bottom of that window (there's the debug window, with a list of errors/warnings, then there's the window with the currently selected error/warning... that's the one that had all the warnings listed there).
Additionally, all the previous warnings were listed as warnings, above... Apparently, though, something happened that made Unity not like that I used base.Update();
and base.Start();
, to inherit from the previous start/update methods, without overriding them... Oddly enough, those had been there for quite a while, so I'm not sure what happened, but it's fixed now.
Start()
and Update(
) are called by the engine using reflection. Even if you want to call the base method, you have to make them virtual
and protected
at least (or public
if you want) and to explicitly override them.
// base class
protected virtual void Start() { }
// derived class
protected override void Start() { base.Start(); }
Actually, this should be the same with all event-based methods of $$anonymous$$onoBehaviour.
Yeah, I'd read up on that. The issue I was running into didn't directly pertain to that, though, as much as the fact that it wouldn't direct me to the actual problem area in the script, from the debugger, and it was mashing all the warning messages in with the error, so it was almost impossible to tell what was actually going wrong :P
Same issue here. Warnings just become Errors when I used base.Start(), base.Update()... Funny.
Answer by gekidoslair · Aug 31, 2015 at 10:18 PM
Ran into the same issue calling a base function from within one of Unity's monobehaviour functions.
I had something like this in the child class
void OnDisable() { base.MyFunction(); }
which completely broke the Unity compiler it seems.
Simply making the base function protected instead of private fixed the issue (don't need the base. prefix optionally as well).
Still lost 1/2 hour trying to figure out why Unity was borked. Must have blown up the Mono compiler in a wierd way.
No that's just you not learning the program$$anonymous$$g language you are using.
$$anonymous$$ethods from base class can only be called in child class is they are at least protected. Private method/property/field are sealed in their own compiled unit (here a class) and cannot be called outisde their definition scope (unless using reflection but taht is another matter).
Answer by whydoidoit · Feb 28, 2013 at 11:40 AM
I'm getting this problem and the compiler is crashing with this error:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
at Mono.CSharp.TypeInference.DoSecondPhase (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeInferenceContext tic, System.Type[] methodParameters, Boolean fixDependent) [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeInference.InferInPhases (Mono.CSharp.ResolveContext ec, Mono.CSharp.TypeInferenceContext tic, Mono.CSharp.AParametersCollection methodParameters) [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeInference.InferMethodArguments (Mono.CSharp.ResolveContext ec, System.Reflection.MethodBase method) [0x00000] in <filename unknown>:0
at Mono.CSharp.TypeManager.InferTypeArguments (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments arguments, System.Reflection.MethodBase& method) [0x00000] in <filename unknown>:0
at Mono.CSharp.MethodGroupExpr.IsApplicable (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Int32 arg_count, System.Reflection.MethodBase& method, System.Boolean& params_expanded_form) [0x00000] in <filename unknown>:0
at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& Arguments, Boolean may_fail, Location loc) [0x00000] in <filename unknown>:0
at Mono.CSharp.ExtensionMethodGroupExpr.ResolveOverloadExtensions (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Mono.CSharp.NamespaceEntry ns, Location loc) [0x00000] in <filename unknown>:0
at Mono.CSharp.ExtensionMethodGroupExpr.OverloadResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Arguments& arguments, Boolean may_fail, Location loc) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.ResolveContext ec, Mono.CSharp.Expression right_side) [0x00000] in <filename unknown>:0
at Mono.CSharp.MemberAccess.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Assign.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.SimpleAssign.DoResolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec, ResolveFlags flags) [0x00000] in <filename unknown>:0
at Mono.CSharp.Expression.Resolve (Mono.CSharp.ResolveContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.If.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.TryCatch.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.Block.Resolve (Mono.CSharp.BlockContext ec) [0x00000] in <filename unknown>:0
at Mono.CSharp.ToplevelBlock.Resolve (Mono.CSharp.FlowBranching parent, Mono.CSharp.BlockContext rc, Mono.CSharp.ParametersCompiled ip, IMethodData md) [0x00000] in <filename unknown>:0
(Filename: Line: 0)
The error in the Unity log is just the same old - warning compressed into a compiler internal error
Added as an answer as the stack trace is too long for a comment.
If you look, there is a null pointer reference. Just click the error (or double click) and it should take you back to the line. If it's your script, make sure variables are loaded, or check for null before using.
If its not your script (and belongs to some other package you downloaded or copied) you should look over the documentation for the package and such. You may also need to update the plugin / package.
Handle null references first. Handle errors from top to bottom of list. Errors can cause other errors to appear, and null references cause weird, almost unpredictable things, to occur.
Null Reference with a long stack usually implies a deeply embedded system of calls eventually tried to call on a variable/object that had been destroyed while it was finishing an operation. This can happen if you call a method inside a catch {} that leads to calling the same method it's found in (infinite loop) until you run out of ram for loading an object before you reach a stack trace limit.
Answer by Komak57 · Apr 03, 2014 at 02:07 AM
For those of you who didn't find a resolution for this, note that
try {
if (true)
throw System.NullReferenceException;
} catch {}
will also cause this problem.
Answer by Archie888 · Aug 30, 2015 at 04:14 PM
I had an issue like this, with threaded stuff, tasks involved etc, using Parse with unity. In my case, I had one error line, in which it seemed that warning messages were written on. If you have a scenario like mine, scroll down the whole message, and you will see that this is not only about warnings turning into errors, but there is an actual error message there in the end, with a long stack trace.
My specific error message was: "Unhandled Exception: System.ArgumentException: Trying to emit a local from a different ILGenerator."
I had a try-catch block in the specific code that was causing issues. Removing that try-catch block removed my specific issue.
Very weird. I'll repeat this post in all threads on the issue I can find, perhaps it can help someone.
Your answer
Follow this Question
Related Questions
Internal Compiler Error again 1 Answer
error CS0016 - Access to the path is denied 1 Answer
Internal Compiler Error 6 Answers
Internal Compiler Error 1 Answer
Internal Compiler Error 0 Answers