开发者

JIT / AOT problems when running montouch app

开发者 https://www.devze.com 2023-04-08 20:39 出处:网络
I have been developing a monotouch opengl iphone game for some weeks now. As recently as yesterday, it was building and running properly on my test hardware (an iPhone 4). But when I loaded the projec

I have been developing a monotouch opengl iphone game for some weeks now. As recently as yesterday, it was building and running properly on my test hardware (an iPhone 4). But when I loaded the project yesterday, it gave me the compiler error:

Framework 'Mono for iPhone' not Installed.

I can't think of any reason for this, I had not changed my system or source code. Luckily Monodevelop was already harassing me with a download link for the latest api download. I installed and the error went away. But instead, I now get a runtime error when the app starts http://screencast.com/t/EXyNqqhNoEsu :

System.ExecutionEngineException has been thrown. Attempting to JIT compile method ... FirstOrDefault ... while running with --aot-only. 

This occurs while trying to create a new DataContractSerializer to load some XML settings: http://screencast.co开发者_StackOverflow中文版m/t/4SDzU5ygg

This compelled me for the first time to change the Linker behavior setting under the app's project options. It was set to 'Don't link', as it has been. When I switch to 'Link SDK assemblies only', it runs without the above exception.

This would be great, problem solved, except that it takes almost half an hour (!) to compile and deploy to the phone in this mode. The build output sits on 'Linking SDK only for assembly...'. Is this normal? I don't think I can keep my sanity with build times that long. Even 'Don't Link' takes about five minutes which is a grueling pace when you're trying to troubleshoot.

To reiterate, this is code that was working every day for weeks, and to my knowledge has not been changed from its working state. Does anyone know why this error is occurring now, and what a resolution might be to continue using the 'Don't Link' option?


Framework 'Mono for iPhone' not Installed.

For some reason MonoDevelop could not find your MonoTouch installation. I can't say why, but restarting MonoDevelop and checking the MD preferences for SDK Locations (and fix the path if MonoTouch was not found) would have been the best options to try.

System.ExecutionEngineException has been thrown. Attempting to JIT compile method ... FirstOrDefault ... while running with --aot-only.

MonoTouch 4.2[.1] can sometime throw a ExecutionEngineException when the "Don't link" linker option is selected. This bug was fixed and will be part of future releases of MonoTouch.

FWIW Link SDK assemblies is the default and should always be used for device builds. The linker will produce much smaller applications and it also allows faster builds in most circumstances (because the linker can save 100kb faster than the AOT compiler can process that 100kb).

If you hit a case where the linker takes a very long time then something is wrong (or at least weird) in your project. Please take the time to fill a bug report at http://bugzilla.xamarin.com so we can investigate why this takes so long.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号