[MonoTouch] "Get" method not found Monotouch

Chris Hatton christopherhattonuk at gmail.com
Fri Mar 23 21:26:59 UTC 2012


Hi Josh,

It's not an uncommon problem... There is a *[Preserve]* attribute which 
you can add to any member, instructing the linker that it should not be 
stripped from output.

 From the following page: http://docs.xamarin.com/ios/troubleshooting


      System.MissingMethodException (anything else)

The member was likely removed by the linker, and thus doesn't exist in 
the assembly at runtime.  There are several solutions to this:

  * Add the [Preserve]
    <http://www.go-mono.com/docs/index.aspx?link=T:MonoTouch.Foundation.PreserveAttribute> attribute
    to the member.  This will prevent the linker from removing it.
  * When invoking mtouch
    <http://www.go-mono.com/docs/index.aspx?link=man:mtouch%281%29>, use
    the *-nolink* or *-linksdkonly* options.
      o *-nolink* disables all linking.
      o *-linksdkonly* will only link MonoTouch-provided assemblies,
        such as /monotouch.dll/.

Note that assemblies are linked so that the resulting executable is 
smaller; thus, disabling linking may result in a larger executable than 
is desirable.

I see you already solved you immediate issue in the time it took me to 
quickly throw the laptop off the table 'mid-post' to eat dinner... but 
this still might be of use to you or someone else.

- Chris



On 23/03/12 19:52, jhandel at gmail.com wrote:
> Monotouch seems to be "optimizing" out any property setters and 
> getters that aren't directly called.. But this is causing problems 
> when I try to pass an object from one assembly to the next..
>
> How do I ask Monotouch to be less agressive about its optimizations? 
> This happens with a debug build to the device with linking set to all 
> assemblies.. Simulator works just fine..
>
> Thanks
> Josh
>
>
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monotouch/attachments/20120323/3340ccc1/attachment-0001.html>


More information about the MonoTouch mailing list