[MonoTouch] mtouch linker & reflection

Jb Evain jb at nurv.fr
Sat Aug 15 07:37:26 EDT 2009

Hey Mark,

On 8/15/09, Mark Beaton <mark at beaton.co.nz> wrote:
>  I'm having some problems with the linker removing members that are
>  being used (via reflection and Activator.CreateInstance()). Passing --
>  nolink gets the app running, but obviously the deployed code size is
>  greater.

You can use -linksdkonly to preserve your application completely,
while still linking the sdk.

>  Is reflection permitted, given the various runtime limitations? For
>  example, accessing a PropertyInfo via
>  someType.GetProperty("PropertyName") and setting its value? I
>  appreciate how difficult it must be for the linker to analyse
>  assemblies that use reflection like this...

The linker can not detect such case

>  Perhaps there could be an attribute we could apply to members that
>  force them not to be removed by the linker? (Maybe there already is?)

That's indeed a possibility. I'll have to think about that. In the
meantime, I really suggest you use -linksdkonly.

Jb Evain  <jb at nurv.fr>

More information about the MonoTouch mailing list