Click here to Skip to main content
13,347,998 members (56,280 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 27 Feb 2013

MonoTouch – MonoDevelop Linker Hell

, 27 Feb 2013
Rate this:
Please Sign up or sign in to vote.
One of the first learning experiences I had when I dove into development was the linking functionality built into MonoTouch.

OverDog is my first project which uses Xamarin, a cross-platform tool for creating applications in C#. I've nothing but adoration for the platform, but one of the first learning experiences I had when I dove into development was the linking functionality built into MonoTouch.

The linker basically reads your applications possible execution paths and removes unused code. I was unaware of this functionality when I started development, but soon ran into problems when trying to deserialize some JSON into a class I created to hold user data. The JSON.NET library was telling me that my class was missing a default constructor, which simply wasn't the case. What I came to realize was that the linker was pulling out most of my data structures!

I alleviated the problem by attaching a [Preserve] compiler tag to each of my data model classes. To prevent all members of the class from being touched by the linker, you simply add an AllMembers argument:

public class User

That solved my issues with the linker. This was a huge headache without any obvious acknowledgment by MonoTouch that this was occurring. What was confusing to me is the fact that my application's execution paths should have included my model data classes. The fact that they were being chopped up by the linker seems to be a bug.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Kiefer Hagin
Software Developer OverDog
United States United States
Software Developer at OverDog

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
YannicSt28-Feb-13 8:46
memberYannicSt28-Feb-13 8:46 
GeneralRe: My vote of 5 Pin
Kiefer Hagin28-Feb-13 8:48
memberKiefer Hagin28-Feb-13 8:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 27 Feb 2013
Article Copyright 2013 by Kiefer Hagin
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid