Hi,
during last weeks we’ve create a huge portion of C# script, about 10000 lines already… Today we encountered the first crash and it is pretty strange. Just outcommenting a function call that almost does nothing crashes unity. Details refer to “Mono.dll” Access Violation… BTW: Maybe a feature for Unity 4. It is not pleasurable to having Unity crashed or freezed when the game does… This should be separated! Also some more information about why a crash has occurred, especially when Mono is involved, would be nice…
There is no way that this shall happen! We have looked closely at all related code and this function we are outcommenting here can just have no impact of that kind!
What I have experienced is that especially Mono 2.6, which Unity is using?! has caused similar troubles to us in the past (not with unity) when porting NET code to MONO. Is there any chance you will update the Mono Runtime to 2.10? This one really seems to be stable and has caused no trouble in the past with any code we tried to run…
regards
chris
Woar… Ok it was a StackOverflowException there were just more of them so solving one issue actually looked like it hadn’t solved anything… Damn the multi-conditional-recursion…
What this comes down to is: Unity really needs a proper Debugger… The combination MonoDevelop is just crap! Even if Unity helps a lot when writing code without a debugger (since you get some sort of realtime object inspection and debug output at least), sometimes it is just a burden without one, thats why they were invented ;). Maybe something for Unity 4: VisualStudio Debugger!
MonoDevelop is the only proper debugger for Mono
And MonoDevelop attached debugger allows to do exactly those things you mention.
The VS Debugger does not help, its for MS .NET
Yes in theory it does. The thing is that if I press “next line” or whatever, it takes about 1-2 seconds until it does arrive and this is something you can not use ;)… I know that MonoDevelop without Unity is quite fast in debugging, so the issue will be somewhere else…
If the Unity editor crashes it is a bug, even if some exception is thrown in the runtime. Please make a bug report with steps and project to reproduce the crash.
I know this is desirable… But honestly I would have no clue except to generate a StackOverflowException using some simple recursion within a MonoBehaviour’s Update() methods, attached to the main camera. This closely matches the scenario we have but we can’t hand out any source code and setting up such a project I just described should be pretty easy for everyone ;). I just can’t guarantee that it crashes with this simplification, which means without our specific source code around it, even though it would be wierd.
The problem as I see it is that with StackOverflowExceptions further exception handling might become quite tricky… And sometimes it seems to work, sometimes it doesn’t. Just depends on the stack state I believe. But at least it shouldn’t crash Unity… 
you don’t need to hand out the code to public but to UT which goes under NDA
And yes it shouldn’t crash unity but depending on what you do on your code and if you use stuff that messes the state, it still can. Good examples of stuff that breaks are threads and async returning things not correctly terminated before you end play mode (OnApplicationQuit will not do it, as its instantly gone but the .net environment remains there as play mode runs in editor environment)
I don’t know if this has to with what were talking about here, but it took 20 seconds for Mono to open a script (mono was already open).