I'm embedding Mono runtime into existing Cocoa application. I've built the latest runtime from GitHub (master branch) and exiting application after running some managed code gives me this during the mono_jit_cleanup():
https://dl.dropbox.com/u/108566029/BAD_ACCESS.png
It's only reproduced when I try to send HTTP request via HttpWebRequest. Specifically if I call GetRequestStream(). The code works fine and all the managed objects are disposed correctly. The mono_jit_cleanup() is called only once. The problem occurs only during shutting down the runtime.
This is also reproduced on the latest Mono 2.10.x branch. But I get SIGSEGV then.
This can occur in different places, so it seems like a threading issue.
So, how should I shutdown the runtime correctly. Is mono_jit_cleanup() call sufficient to correctly dispose of the runtime? And can I exit the application without disposing runtime (no mono_jit_cleanup() call)?
P.S.
I'm using 32-bit build of Mono v2.0 (3.5 actually) runtime on OSX 10.8.3. I link against libmono-2.0.1.dylib, so it should be Boehm GC. The same problem is also reproduced with SGen GC.
P.P.S
Here goes another error https://dl.dropbox.com/u/108566029/SIGABRT.png