[Mono-dev] Exception in runtime-invoke Wrapper

Martin Däumler mdae at cs.tu-chemnitz.de
Tue Jan 18 06:11:43 EST 2011


Hello,

when executing mono/tests/delegate1.cs, "d.EndInvoke(ar1)" does not
resume when the async call "d.BeginInvoke()" terminates.

I guess that the problem is caused by an exception thrown by the
wrapper used to call the setter of WaitHandle. The call stack
(using GDB/DDD) of the call to "d.EndInvoke(ar1)" is as follows:

#6: mono_delegate_end_invoke(), marshal.c:2553
#5: mono_thread_pool_finish(), threadpool.c:1203
#4: mono_wait_handle_new(), object.c:5192
#3: mono_runtime_invoke(), object.c:2654
#2: mono_jit_runtime_invoke(), mini.c:4789
#1: (wrapper runtime-invoke) object:runtime_invoke_void__this_intptr ()
#0: System.Threading.WaitHandle:set_Handle(), WaitHandle.cs:419

While executing the wrapper (#1 in the call stack) following
exception, as shown by GDB and which does not cause a crash,
occurs:

<type 'exceptios.RuntimeError'>
Cannot access memory at addres 0x49c6

The result is, that the setter gets a wrong value. In particular,
the setter gets the address of the handle, i.e., one dereference
is missing.

I use a custom Mono VM based on Mono 2.6.1 tarball on a x86
architecture running Linux. It is customized in the way that
all possibly called/refrenced methods and classes of the
involved assemblies are pre-compiled using the MCS (for a
research project that is about using C# for soft realtime)!
This pre-compilation done in scope of an initialization
routine. It is similar to "mono_precompile_assembly()" in
mini.c, extended by full-aot code in order to precompile
more wrappers etc. It is notable that during this
pre-compilation all class constructors are compiled,
i.e., that static class constructors are executed during
this pre-compilation.

So, the above mentioned setter
"System.Threading.WaitHandle:set_Handle()" is also called during
pre-compilation by
"System.IO.IsolatedStorage.IsolatedStorageFile:.cctor()".
When deactivating this pre-compilation all works fine. So, my
questions are:

a) Where is the class constructor of IsolatedStorageFile? I can not
find it in "mcs/class/corlib/System/IsolatedStorageFile.cs".

b) Why might the wrapper throw an exception?


I hope to get some hints please.


With kind regards,
Martin Däumler


More information about the Mono-devel-list mailing list