[Mono-devel-list] Thread hang from TypeInitializationException

Bruno Fernandez-Ruiz brunofr at olympum.com
Sat Feb 28 16:00:55 EST 2004


I forgot to mention that the TypeInitializationException does occur, but
after that the Test program freezes.

brunofr at localhost brunofr $ ./Test.exe
 
Unhandled Exception: System.TypeInitializationException: An exception
was thrown by the type initializer for Test ---> System.SystemException:
I am locked
in <0x0002b> Test:.cctor ()
--- End of inner exception stack trace ---

>>> and it freezes ... Ctrl + C

Bruno

On Sat, 2004-02-28 at 22:36, Bruno Fernandez-Ruiz wrote:
> Hi
> 
> 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?
> 
> Thanks!
> Bruno
-- 
Bruno Fernandez-Ruiz <brunofr at olympum.com>
The Olympum Group,  http://www.olympum.com




More information about the Mono-devel-list mailing list