如何强制Monotouch AOT编译器查看嵌套的泛型方法?

Fel*_*lix 25 xamarin.ios aot servicestack

我不得不跳过篮球,但我几乎设法在我的项目中ServiceStack使用iOS Monotouch.一个运行时JIT异常就是:

System.ExecutionEngineException: Attempting to JIT compile method 'ServiceStack.Text.Json.JsonTypeSerializer:GetWriteFn<int> ()' while running with --aot-only. 
Run Code Online (Sandbox Code Playgroud)

违规代码非常简单:

   internal WriteObjectDelegate GetWriteFn<T>()
    {
        return JsonWriter<T>.WriteFn();
    }
Run Code Online (Sandbox Code Playgroud)

作为测试,我修改了SS代码以使内部方法和类型公开,并在我的项目的启动代码中包含以下内容(实际上被调用).

var ick = ServiceStack.Text.Json.JsonWriter<int>.WriteFn();
var erk = ServiceStack.Text.Json.JsonTypeSerializer.Instance.GetWriteFn<int>();
Run Code Online (Sandbox Code Playgroud)

由于某种原因,这仍然没有提醒AOT,当上面的代码执行时我得到了异常!这是因为泛型参数是值类型吗?或者是因为这些是静态类和方法?如何强制Monotouch AOT上述方法?

有问题的SS代码位于JsonTypeSerializer.cs和JsonWriter.Generic.cs中:https: //github.com/ServiceStack/ServiceStack.Text/tree/master/src/ServiceStack.Text/Json

gle*_*udr 1

现在单点触控有一些通用的限制。我认为你应该检查你的代码给其中之一。