[mono-android] Could not load type exception (generic interfaces in a class library) Preview 14

Amir Waldman amirw2k at gmail.com
Sun Mar 13 20:32:23 EDT 2011


I've traced a bug in Preview 14 regarding generic interfaces instantiated in
the main assembly but defined on a class library. I don't know what you
changed but it worked in Preview 13.

Basically it happens when a generic interface is using another interface,
both of them are defined in a class library. When you try to instantiate an
instance you get an exception: 'Could not load type...'

 

To recreate this bug:

 

1. Create a monodroid project linked to a monodroid class library

2. The class library should include the following code:

 

   public interface IA

    {

        void Do();

    }

    

    public class A : IA

    {

        public A()

        { }

 

        public void Do()

        {           

        }

    }

 

    public interface IB

    {

        void Do();

    }

    

    public class B<TA> : IB

        where TA : IA, new()

    {

        public B()

        {

        }

 

        public void Do()

        { 

        }

    }

 

 

3. The main assembly has a member of interface IB called: IB b;

 

4. Instantiate the member on a method called in OnCreate and you get an
exception:  b = new B<A>();

 

"Could not load type 'MonoDroid2.A' from assembly 'MonoAndroidClassLibrary2,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'." string

 

Please fix this bug, I'm back to Preview 13 again...

 

Regards,

Amir

 

 

From: Amir Waldman [mailto:amirw2k at gmail.com] 
Sent: Sunday, March 13, 2011 4:20 PM
To: 'monodroid at lists.ximian.com'
Subject: RE: [mono-android] Preview 14 Available - can't deploy

 

I restored an older version of my code that works with Preview 14, I'll
investigate more into this later.

 

Thanks,

Amir

 

From: Kestutis Tauckela [mailto:kestutis.tauckela at gmail.com] 
Sent: Sunday, March 13, 2011 2:17 PM
To: Amir Waldman
Subject: Re: [mono-android] Preview 14 Available - can't deploy

 

Works flawlessly now in my case. Thank you for fixing.

Good luck!
Kestutis Tauckela
http://www.outlanderstudios.com

On Sun, Mar 13, 2011 at 1:39 PM, Amir Waldman <amirw2k at gmail.com> wrote:

Thanks for the quick fix!

It solved the dialog problem, but I still get the 'No    Source Available'
crash inside OnCreate() trying to call a private method after successfully
calling base()


> > 'No Source Available'.
> >
> > Call stack location:
> >
> > 0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at
> >
>
>
/home/jon/Development/mono-droid/mono/mcs/class/corlib/System.Diagnostics/De
> > bugger.cs:124
> >

It happens with a project that is working fine with Preview 13 so something
is broken in this preview. I managed to debug a simple test project though.

Samsung Galaxy S, removed previous runtime manually.


Regards,
Amir
-----Original Message-----
From: monodroid-bounces at lists.ximian.com

[mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Joseph Hill
Sent: Sunday, March 13, 2011 5:50 AM
To: kestutis.tauckela at gmail.com; monodroid at lists.ximian.com
Subject: Re: [mono-android] Preview 14 Available - can't deploy

We have uploaded a minor update which should correct this:
http://go-mono.com/monodroid-download/mono-android-9794.msi

Sorry for the inconvenience.

--Joseph

>>> Kestutis Tauckela <kestutis.tauckela at gmail.com> 03/12/11 16:38 PM >>>
I've got same issue using Samsung Galaxy S. It doesn't prevent deployment
and ignoring warning message - everything works just fine.
I tried deleting shared mono runtime manually however after it was uploaded
during next run of my game, it started to complain again.

Kestutis Tauckela
http://www.outlanderstudios.com

On Sat, Mar 12, 2011 at 7:30 PM, Amir Waldman <amirw2k at gmail.com> wrote:

> Yes I did.
>
> I manually uninstalled the runtime again in order to let Preview 13 work,
> otherwise I'd just get that button_click exception even with P13
> installed...
> I'm now back to 13 till you get it sorted out.
>
> Amir
>
> -----Original Message-----
> From: Jonathan Pobst [mailto:monkey at jpobst.com]
> Sent: Saturday, March 12, 2011 6:51 PM
> To: Amir Waldman
> Cc: monodroid at lists.ximian.com
> Subject: Re: [mono-android] Preview 14 Available - can't deploy
>
> Did you manually uninstall the old runtime(s)?
>
> Jonathan
>
>
> On 3/12/2011 9:42 AM, Amir Waldman wrote:
> > Jonathan, I sent you the log by mail.
> >
> > When I skip this dialog, I get an error screen in visual studio:
> >
> > 'No Source Available'.
> >
> > Call stack location:
> >
> > 0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at
> >
>
>
/home/jon/Development/mono-droid/mono/mcs/class/corlib/System.Diagnostics/De
> > bugger.cs:124
> >
> >
> >
> > I don't get this problem in a new project.
> >
> >
> >
> > Amir
> > -----Original Message-----
> > From: Jonathan Pobst [mailto:monkey at jpobst.com]
> > Sent: Saturday, March 12, 2011 5:13 PM
> > To: monodroid at lists.ximian.com
> > Cc: Amir Waldman
> > Subject: Re: [mono-android] Preview 14 Available - can't deploy
> >
> > This should not keep you from deploying to the device.  Click OK and it
> > should continue to deploy.
> >
> > Having said that, I thought I fixed it explicitly for Samsung devices.
> > If someone could turn on ADB logging (Tools->Options->Mono for Android),
> > and send me the monodroid.log created onyour desktop, I can look at why
> > it cannot be detected.
> >
> > Jonathan
> >
> >
> > On 3/12/2011 9:04 AM, Amir Waldman wrote:
> >> Can't deploy to device
> >>
> >> I get a message saying "There is a shared runtime on the device whose
> >> version cannot be determined...".
> >>
> >> Attached an image
> >>
> >>
> >> Regards,
> >> Amir
> >>
> >> -----Original Message-----
> >> From: monodroid-bounces at lists.ximian.com
> >> [mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Jonathan Pobst
> >> Sent: Saturday, March 12, 2011 12:26 AM
> >> To: Monodroid at lists.ximian.com
> >> Subject: [mono-android] Preview 14 Available
> >>
> >> Good news everyone!
> >>
> >> We are happy to release another preview of MonoDroid (r9779)!
> >>
> >> http://go-mono.com/monodroid-download
> >>
> >> Release notes are available here:
> >> http://monodroid.net/Releases/Previews/Preview_14
> >>
> >>
> >> Enjoy!
> >> Jonathan
> >> _______________________________________________
> >> Monodroid mailing list
> >> Monodroid at lists.ximian.com
> >>
> >> UNSUBSCRIBE INFORMATION:
> >> http://lists.ximian.com/mailman/listinfo/monodroid
> >>
> >>
> >>
> >> _______________________________________________
> >> Monodroid mailing list
> >> Monodroid at lists.ximian.com
> >>
> >> UNSUBSCRIBE INFORMATION:
> >> http://lists.ximian.com/mailman/listinfo/monodroid
> >
> >
> >
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>

_______________________________________________
Monodroid mailing list
Monodroid at lists.ximian.com

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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/mailman/private/monodroid/attachments/20110314/4f13eff8/attachment-0001.html 


More information about the Monodroid mailing list