[Mono-devel-list] Thread hang from TypeInitializationException

Bruno Fernandez-Ruiz brunofr at olympum.com
Sat Feb 28 15:36:39 EST 2004


I have a static field initialization throwing an exception which
blocks/hangs my application. From the ECMA-C# specs I see that if the
search for a matching catch block reaches a static constructor or a
static field initilization (such as in my case), a
TypeInitializationException is thrown.

I have written an example that hangs in mcs/mono CVS HEAD. It uses a
static constructor (instead of my field) for simplicity of the test:

using System;

class Test
	static Test () 
		throw new SystemException ("I am locked");
	public static void Main ()

It seems like the initialization thread dies, and the main thread does
not execute any more (the process hangs without consuming CPU). I can't
seem to find anything in bugzilla nor docs related to this. Is this a
bug I should file? I don't actually have Windows, so I don't know if
this works on MS .NET (sorry).

Also, is there a way in mono to obtain a thread dump? Java allows to
send a SIGQUIT to the main Java process and obtain a complete threadump
which contains all the locks and stacks for each thread. I wonder if
Mono has something similar?

Bruno Fernandez-Ruiz <brunofr at olympum.com>
The Olympum Group,  http://www.olympum.com

More information about the Mono-devel-list mailing list