Hello,

 

I have found a new issue in Mono for Android 4.2.8. In the context of an
Activity, running the type casting in the method below fails with an
“Unhandled Exception: System.InvalidCastException: Cannot cast from source
type to destination type. ” error message. It used to work with version
4.2.7 and below.

 

    private Object obj;

 

    private void ProblematicCasting()

    {

      ((MyApplication)Application).Obj = obj;

    }

 

MyApplication class is implemented as shown below. You can download the full
application reproducing the issue at
http://dl.dropbox.com/u/64352823/ApplicationCasting.zip.

 

  [Application]

  public class MyApplication : Application

  {

    public Object Obj { get; set; }

 

    public MyApplication(IntPtr handle, JniHandleOwnership transfer)

      : base(handle, transfer)

    {

    }

 

    public override void OnCreate()

    {

      base.OnCreate();

 

      Obj = new Object();

    }

  }

 

Is this a bug or should I implement this in a different way now?

 

 

Thanks in advance and best regards,

Narcís Calvet

Steema Software

http://www.steema.com <http://www.steema.com/> 

http://twitter.com/SteemaSoftware

https://www.facebook.com/SteemaSoftware

 

 

 

 

_______________________________________________
Monodroid mailing list
[email protected]

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to