[Mono-dev] SIGILL in finally clause without catch

Christian Stümpel mail at christian-stuempel.de
Tue Apr 22 18:14:27 EDT 2008


In code I have to port from MS .NET to mono I observed several SIGILL  
crashes at points in code, where calls to external code are made  
within a try block followed by a finally but *without* a catch  
statement.

		try {
			unrar.dosomething();
			throw new Exception("test");
		}

		// no catch here

		finally
		{
			unrar.close(); // calls unmanaged code
			
		}

The unmanaged code called in unrar.dosomething() is C++ code compiled  
with exceptions enabled but it does not throw the exception, but the  
managed code that follows. The call to unrar.close() (which does not  
throw any exception) in the finally clause crashes with:

System.ExecutionEngineException: SIGILL
   at (wrapper managed-to-native)  
NntpApp.nntp.rar.Unrar:RARCloseArchive (intptr)
   at NntpApp.nntp.rar.Unrar.Close () [0x00000]
   at usenextapp.FilegroupPreview.ExtractFileFromRar (System.String  
path) [0x00000]

The SIGILL does not appear if I catch the exception and rethrow it in  
the finally clause

		Exception e=null;
		try {
			unmanaged1();
			throw new Exception("test");
		}

		catch(Exception ex)
		{
			e= ex;
		}

		finally
		{
			cleanup();
			if (e!=null)
				throw e;
		}

Any thoughts on that?

Christian Stümpel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080422/58f90750/attachment.html 


More information about the Mono-devel-list mailing list