user1563232
user1563232

Reputation: 361

Xamarin Android app crashes in release mode (default constructor not found)

I have a Xamarin app here that runs in debug mode without any problems, but in release mode it crashes instantly saying that a default constructor for one of my pages is missing.

Unhandled Exception:

System.MissingMethodException: Default constructor not found for type PraxisApp.MasterPage occurred

Does anyone have any suggestions why this happens in Release mode?

Upvotes: 2

Views: 1077

Answers (2)

Maxim Matusevich
Maxim Matusevich

Reputation: 21

Try to add 'PraxisApp.MasterPage;' to your Ignore assemblies (ProjectSettings -> Android Build -> Linker)

Upvotes: 0

SushiHangover
SushiHangover

Reputation: 74094

It is most likely due to the fact that it is being stripped by the Mono Linker:

Add a PreserveAttribute to the top of your Page class:

[Preserve (AllMembers = true)]
public class MasterPage
{
   ~~~
}

Upvotes: 6

Related Questions