I have an existing very large C# scripted Unity project that worked perfectly under Unity 2.6 Pro running on Windows XP.
I just upgraded to Unity 3.2, and now whenever Unity attempts to compile the scripts, it compiles them all without errors, and then C:\Program Files\Unity\Editor\Data\Mono\bin\mono.exe crashes with an unhandled exception. The result of this is that Assembly-CSharp.dll is never created and the project won’t run.
At first I thought it must be some bad code on my side, but then I tried firing up the MonoDevelop which comes with Unity3, clicking Sync MonoDevelop Project, and building the project using MonoDevelop.
It output a file called “Irrelvant.dll” (yes, that’s the spelling it used). I renamed that file to
“Assembly-CSharp.dll” and copied it to My Project/Library/ScriptAssemblies/
The project was then able to run!!!
This makes me think the version of Mono that Unity3 uses isn’t the same as the one that Unity 3’s MonoDevelop uses… and that the MonoDevelop one is better.
Has anyone seen this bug? Any suggestions about how to get the Unity version of Mono to behave like the MonoDevelop one? It’s not practical for our team to build using MonoDevelop instead of the Unity Editor. We have too many artists and designers who need the Editor to “just work” without playing any compiler games.
Hi, welcome to the forum!
Please can you file a bug report for this (menu: Help > Report A Bug). It would be ideal if you can attach the problematic C# file to the report because it might be useful in tracking down the bug.
check your security programs if they by error sandbox it and alike, that causes it to crash on unity startup
Thanks for the quick response. I’ll file a bug report, but I’m not sure I’m able to provide the specifics yet.
Just to clarify, mono.exe is the thing that crashes when Unity calls it. Unity doesn’t crash at all, and it doesn’t happen at startup, it only happens when Assembly-CSharp.DLL is being generated, so I don’t think it’s anything to do with security.
Unfortunately, our project is almost 400 C# source files, plus 8 separate .NET 2.0 DLLs. I can’t tell which is the offending file… it seems as if its the linking stage, where all of the object code is assembled into a single .DLL that is causing the problem. If I remove a file, or introduce errors on purpose, the compile will report the errors, the project won’t attempt to link, and so the crash doesn’t happen. It’s only when all of the files compile correctly that mono.exe crashes.
That means the only way to identify the offending file (assuming there is an offending file), would be to stub out all 400 files, then add them back half at a time, binary-search style. Ugh. Of course, there might not be an offending file. Maybe mono.exe crashes when trying to link more than 256 files?
Is it possible for you to supply me with a debug version of the Mono that ships with Unity3, so I can see exactly where Mono is crashing?
Or, is there a way to upgrade the Mono that Unity uses to be the same version that the MonoDevelop that ships with Unity? I looked through the directory structures for both – there doesn’t seem to be an obvious mapping that makes me think “copy this .dll here, and Unity’s mono will use the newer version”, but it dosn’t hurt to ask!