[Mono-dev] ARM exceptions

D M dm_mono_dev at yahoo.com
Mon Nov 6 18:16:18 EST 2006


Hi,

I'm having some issues with the exceptions raised from native code on an ARM platform.
I'm using mono-1.1.18.20061027.
    Running this under ARM leads to:
 
  Unhandled Exception: System.InvalidOperationException: boom.
    at ExceptionBug.MyClass.MyMethod (Boolean flag) [0x00000]
    at <0x00000> <unknown method>
   
   
  using System;
  using System.Reflection;
   
  namespace ExceptionBug
  {
        class MyClass
        {
              public void MyMethod(bool flag)
              {
                    if (flag)
                    {
                          throw new InvalidOperationException("boom.");
                    }
              }
        }
   
        class Program
        {           
              public static Exception Invoke(MethodBase method, object obj, params object[] args)
              {
                    Exception exc = null;
   
                    try
                    {
                          method.Invoke(obj, args);
                    }
                    catch (Exception e)
                    {
                          if (e is TargetInvocationException)
                          {
                                exc = e.InnerException;
                          }
                          else
                          {
                                exc = e;
                          }
                    }
                    return exc;
              }
        
              static void Main(string[] args)
              {
                    // Indirectly invoke a method that raises an exception                  
                    MethodInfo method = typeof(MyClass).GetMethod("MyMethod");
                    MyClass obj = new MyClass();
              
                    Exception ex = Invoke(method, obj, true);
                    Console.WriteLine("Exception Caught!\n original raised exception was: {0}\n", ex);
              }
        }
  }
  Thanks,

DM
 
---------------------------------
Sponsored Link

For just $24.99/mo., Vonage offers unlimited local and long- distance calling. Sign up now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061106/3772c719/attachment.html 


More information about the Mono-devel-list mailing list