Hi,

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).

namespace ExceptionTest
{
    class Program
    {
        public static void Main()
        {
            try
            {
                throw new Exception("Test");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.InnerException.Message);
                throw new Exception("Testi2");
            }
        }
        public Program()
        {

        }
    }
}

Same program ran from the command line gives

"Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object"

Cheers,
Janne
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to