简体   繁体   English

HttpClient执行运行时错误:ExecutionEngineException-尝试使用--aot-only进行JIT编译方法

[英]HttpClient execution runtime error: ExecutionEngineException - Attempting to JIT compile method with --aot-only

I'm using Xamarin (MAC) with iOS 6.4.4 update installed. 我使用的Xamarin(MAC)已安装iOS 6.4.4更新。 My touch project uses PCL library with HttpClient enabled. 我的touch项目使用启用了HttpClient的PCL库。 Every time I execute method which uses HttpClient I'm getting the following runtime error: 每次我执行使用HttpClient的方法时,都会出现以下运行时错误:

System.ExecutionEngineException: Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_void__this___HttpWebRequest_long (System.Net.HttpWebRequest,long)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

  at System.Lightup.Call[HttpWebRequest,Int64] (System.Delegate& storage, System.Net.HttpWebRequest instance, System.String methodName, Int64 parameter) [0x00000] in <filename unknown>:0 
  at System.Lightup.Set[HttpWebRequest,Int64] (System.Delegate& storage, System.Net.HttpWebRequest instance, System.String propertyName, Int64 value) [0x00000] in <filename unknown>:0 
  at System.Net.HttpWebRequestLightup.SetContentLength (System.Net.HttpWebRequest instance, Int64 value) [0x00000] in <filename unknown>:0 
  at System.Net.Http.HttpWebRequest.set_ContentLength (Int64 value) [0x00000] in <filename unknown>:0 
  at System.Net.Http.HttpClientHandler.StartRequest (System.Object obj) [0x00000] in <filename unknown>:0

How can I fix that issue? 我该如何解决该问题?

I know I'm almost 3 years late :) but today I ran into this issue. 我知道我快迟了3年:),但今天我遇到了这个问题。 PCL's are now supported so I thought it might be helpful to add some additional information to this question. 现在支持PCL,因此我认为向该问题添加一些其他信息可能会有所帮助。

If you reference System.Net.Http in your PCL project, by for instance using the Microsoft.Net.Http NuGet package, you then have to add that reference also to your iOS project. 如果您在PCL项目中引用System.Net.Http,例如通过使用Microsoft.Net.Http NuGet包,则必须将该引用也添加到iOS项目中。 You can simply do this by also installing this NuGet package on your iOS project. 您只需在iOS项目中安装此NuGet软件包即可完成此操作。

This will force the iOS project to use the Mono iOS version of the System.Net.Http dll's instead of the PCL's variant, which is probably net45 or something like that. 这将迫使iOS项目使用System.Net.Http dll的Mono iOS版本而不是PCL的变体,后者可能是net45或类似的东西。

I think that this problem occurs because the net45 variant of System.Net.Http uses reflection to invoke some methods. 我认为发生此问题是因为System.Net.Http的net45变体使用反射来调用某些方法。 Note that the error states that some invocation is tried and that this requires a JIT compilation. 请注意,该错误指出尝试了某些调用,并且这需要JIT编译。 This is however prohibited on iOS physical devices and not on iOS simulators. 但是,这是在iOS物理设备上禁止的,而不是在iOS模拟器上禁止的。 iOS physical devices require Ahead of Time(aot) compiling. iOS物理设备需要提前编译。

Attempting to JIT compile method '(wrapper delegate-invoke) <Module>:invoke_callvirt_void_HttpWebRequest_bool (System.Net.HttpWebRequest,bool)'

PCLs are still not offically supported. PCL仍然不受官方支持。 Especially when async/await is involved. 特别是在涉及异步/等待时。 In the meantime you could to why I do and create a platform specific class library and adding your source files as Link (Visual Studio does that if you ALT-Drag files from Windows Explorer to the VS Solution Explorer and Xamarin Studio offers the Link option automatically when it sees source files outside of the target project). 同时,您可以解释为什么我会创建一个平台特定的类库并将您的源文件添加为链接(如果您将ALT文件从Windows资源管理器中ALT拖动到VS解决方案资源管理器中,并且Xamarin Studio自动提供了链接选项,Visual Studio会这样做当它看到目标项目之外的源文件时)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 [MonoTouch] [Bass.dll]应用程序崩溃“尝试使用-aot-only运行JIT编译方法.. - [MonoTouch][Bass.dll] Application crash “Attempting to JIT compile method .. while running with --aot-only” ExecutionEngineException:尝试JIT编译方法 - ExecutionEngineException: Attempting to JIT compile method System.ExecutionEngineException:仅在设备上的调试模式下尝试JIT编译方法(MonoTouch) - System.ExecutionEngineException: Attempting to JIT compile method only in Debug Mode on device (MonoTouch) 尝试在MonoTouch.CoreGraphics.CGContext.DrawPDFPage中进行JIT编译方法异常 - Attempting to JIT compile method exception in MonoTouch.CoreGraphics.CGContext.DrawPDFPage Protobuf-net尝试JIT编译方法&#39;(包装动态方法)ClassExtensions.StringArray - Protobuf-net Attempting to JIT compile method '(wrapper dynamic-method) ClassExtensions.StringArray 试图使用JIT编译方法&#39;(包装器委托调用) - System.Net.HttpWebRequest - Attempting to JIT compile method '(wrapper delegate-invoke) - System.Net.HttpWebRequest 第三方库的Unity / Monotouch / C#设置委托中的JIT编译方法错误 - JIT compile method error in Unity/Monotouch/C# setting delegate for 3rd party library Xamarion IOS LexDB Save-尝试进行JIT编译的异常(包装委托调用) - Xamarion IOS LexDB Save - exception attempting to JIT compile (wrapper delegate-invoke) 运行montouch应用程序时出现JIT / AOT问题 - JIT / AOT problems when running montouch app 调用method_getImplementation会在设备上引发ExecutionEngineException - Calling method_getImplementation throws ExecutionEngineException on device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM