Balasubramanian
Balasubramanian

Reputation: 73

MissingMethodException in Xamarin.iOS

I was facing the MissingMethodExeption while using the reflection method in Xamarin.iOS. My code works fine when Linker Behavior is set to Don't Link. But i am getting the above exception when Linker behavior is set to Link SDK assemblies. I have tried the workaround to set the --linkskip=System.Core but exception raised. Can you please let me know if you have any answer for this problem.

I am getting the error while performing the following operation. Activator.CreateInstance(resultType) as ScriptObject. Here resultType is a Type and ScriptObject is a class which perform some operations for me.

Upvotes: 0

Views: 75

Answers (1)

Stephane Delcroix
Stephane Delcroix

Reputation: 16222

A quick and dirty way to avoid some methods/types to be linked out is to reference them in unused code:

if (false) {
    var a = new TypeToPreserve();
    a.MethodToPreserve();
}

Upvotes: 1

Related Questions