I've broken everything down to an extremely simple test, this crashes for me about every other run with an access violation 0x00000C (so a null pointer somewhere in mono_runtime_invoke). It seems related to Console.WriteLine; if it is removed the crashing stops.
Code [Pastebin]: C++: http://pastebin.com/x4d24xPH C#: http://pastebin.com/uJuFnXEL Code [Raw]: C++: MonoClass* monoClass = mono_class_from_name( monoImage, "Test", "TestClass" ); MonoObject* monoObj = mono_object_new( monoDomain, monoClass ); mono_runtime_object_init( monoObj ); int handle = mono_gchandle_new( monoObj, false ); MonoMethodDesc* monoMethodSetSomeValueDesc = mono_method_desc_new( "Test.TestClass::__internal_SetSomeValue", true ); MonoMethod* monoMethodSetSomeValue = mono_method_desc_search_in_class( monoMethodSetSomeValueDesc, monoClass ); int test = 1234; void* args[1]; args[0] = &test; MonoObject* exc; MonoObject* testObj = mono_gchandle_get_target( handle ); std::cout << "Test Obj: " << testObj << std::endl; mono_runtime_invoke( monoMethodSetSomeValue, mono_gchandle_get_target( handle ), args, &exc ); mono_gchandle_free( handle ); C#: using System; namespace Test { public class TestClass { public TestClass() { } public int someValue = 0; public void __internal_SetSomeValue(int val) { someValue = val; Console.WriteLine(val); } } } -- View this message in context: http://mono.1490590.n4.nabble.com/mono-runtime-invoke-crash-tp4663860.html Sent from the Mono - General mailing list archive at Nabble.com. _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list