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

Amir Waldman amirw2k at gmail.com
Tue Mar 15 07:31:39 EDT 2011


Hi,

First, I can assure you nothing has changed in my code. It still works in Preview 13 when I set the system time to a week earlier!

I tried using the 'Preserve' attribute trick on a few classes, but instead of giving me the name of the type in the exception as it did before, it simply showed a very general exception (with no type specified): 'A type load exception has occurred.'


I should add that the class that I reported earlier is derived from another class that is derived from another class that implements an interface (that was the 'A' class if you check my code sample. A : A1 => A1: A2 => A2 : IA). Even when I added the 'Preserve' attribute to the entire hierarchy, I still got the general 'type load' exception with no type specified. It is specified only when there was no use of this attribute at all. Furthermore, I couldn't see any indication for this in the ADB log like Jon showed in a  previous message.


I just changed Linking in both class library and main assembly to 'Sdk Assemblies Only' and it loads again (that's all I checked for now). I don't see any changes in the size of the APK either since Preview 13.

Thanks for looking into this, I'd like to use the full capabilities of the linker. What are the benefits of linking user assemblies?



Regards,
Amir



-----Original Message-----
From: Jb Evain [mailto:jbevain at gmail.com] 
Sent: Tuesday, March 15, 2011 12:50 PM
To: monodroid at lists.ximian.com
Cc: Amir Waldman
Subject: Re: [mono-android] Could not load type exception (generic interfaces in a class library) Preview 14

Hi,

On Tue, Mar 8, 2011 at 10:39 AM, Amir Waldman <amirw2k at gmail.com> wrote:
> Does disabling linking means that the APK will go up to 15MB?

As an intermediate step, you can use the Link SDK only setting, which
leaves your assemblies untouched.

> What are the implications of this 'Preserve' attribute in terms of runtime,
> debugging, memory usage, etc?

Simple: none :)

> You say you may not be able to fix it. Can you explain why it worked in
> Preview 13 but broke one preview later?

There was no change in the linker during those two previews, so I
suspect a change in your code base triggered this.

Thanks for reporting this,

Best,

Jb



More information about the Monodroid mailing list