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.
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.
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
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.
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.
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.