[Mono-dev] NullReferenceException thrown inside catch
janne.rantala at gmail.com
Thu Aug 24 08:28:21 EDT 2006
I found out that when NullReferenceException is thrown inside catch
clause in embedded environment, Mono crashes. Normally when method is
invoked with mono_runtime_invoke, exceptions are stored in MonoObject
but somehow this does not happen in this case.
This happened when I tried to print out message from InnerException
which didn't exist.
Here is the code, without that Console.WriteLine it works ok
(exception is stored in MonoObject).
public static void Main()
throw new Exception("Test");
catch (Exception e)
throw new Exception("Testi2");
Same program ran from the command line gives
"Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object"
More information about the Mono-devel-list