How to force not to delete a class when linking? I am writing an Android application in Visual Studio 2015 on the Xamarin framework. Faced such a problem: the application works fine in the Debug mode, but when I put the Release mode, some of the application functionality is lost, i.e. Several classes are deleted when linking and when they are called, the application crashes. I tried to put one of the attributes in front of the class as written in the Xamarin documentation:
[Android.Runtime.Preserve] [Android.Runtime.Preserve (AllMembers = true)] [Android.Runtime.Preserve (Conditional = true)] did not help. I also tried:
#pragma warning disable 0219, 0649 also did not help. I also tried using linkskip , but it didn't help either.
The only solution that I have found so far is to specify Linker Behavior = Don't Link (None in Visual Studio) in the linker properties (as in Debug mode). But this is a bad decision, because suitable for debugging, but not for release. And the size of the application has increased by more than 2.5 times!