System.ExecutionEngineException:仅在设备(MonoTouch)的调试模式下尝试JIT编译方法 [英] System.ExecutionEngineException: Attempting to JIT compile method only in Debug Mode on device (MonoTouch)

查看:94
本文介绍了System.ExecutionEngineException:仅在设备(MonoTouch)的调试模式下尝试JIT编译方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下方法:

ApiResponse<T> PostMultipart<T>(string uploadUrl, NameValueCollection formParamters, params UploadFile[] uploadFiles);

UploadFile只是一个Poco:

UploadFile is just a Poco:

public class UploadFile
{
    public string FilePath { get; set; }
    public string ContentType { get; set; }
    public string ParameterName { get; set; }
}

通过调用该方法,使用 Debug |

By calling that method, everyhing works fine on the simulator with "Debug|iPhoneSimulator" and on my iPod Touch with iOS 5.1.1 with "Release|iPhone".

但是当我开始在设备上调试应用程序时( Debug | iPhone),则出现以下异常:

But when I am starting to debug the app on the device ("Debug|iPhone"), I get the following exception:


System.ExecutionEngineException:尝试JIT编译方法'Xyz.Api.ApiClient:PostMultipart(在仅使用--aot的情况下运行时,字符串,System.Collections.Specialized.NameValueCollection,Xyz.Api.UploadFile [])'。有关更多信息,请参见 http://docs.xamarin.com/ios/about/limitations

我在链接页面上看不到任何相关信息。而且我真的无法理解为什么只有在电话调试时才会出现这种情况。

I can't see any relevant information on the linked page. And I can't really understand why that behaviour only occurs when debugging on the phone.

其他人是否能够理解这里发生的情况? :)

Is someone else able to understand what is going on here? :)

推荐答案

您的代码示例不够完整(可重复),但这很可能是 因为您的< T> 是一种值类型(例如 int ,枚举...)。

Your code sample is not complete enough (to duplicate) but this is most likely because your <T> is a value-type (e.g. int, enum...).

AOT编译器很难为无法共享代码的值类型生成代码(就像任何引用类型一样)。解决方法包括:

The AOT compiler has difficulties generating code for value-types where code cannot be shared (like it can for any reference type). Workaround includes:


  • 提示所需的AOT编译器(确保< T> 是已知的,并且会为您使用的值类型生成代码);

  • hinting the AOT compiler of what you need (ensuring <T> is known and code is generated for the value types you're using);

使用引用类型(例如 string )而不是值类型(例如 int

using a reference type (e.g. a string) instead of a value type (e.g. an int)


我真的不明白为什么这种行为仅在电话调试时才会发生。

And I can't really understand why that behaviour only occurs when debugging on the phone.

iOS设备不允许JITting代码(Apple的限制),因此使用AOT。 iOS模拟器没有此限制,因此使用了JIT(因为它比AOTing代码快了很多)。

iOS devices do not allow JITting code (Apple's restriction) so AOT is used. The iOS simulator does not have this restriction, so the JIT is used (because it's a lot faster than AOTing code).

这篇关于System.ExecutionEngineException:仅在设备(MonoTouch)的调试模式下尝试JIT编译方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆