运行 Montouch 应用程序时出现 JIT / AOT 问题
我已经开发一个单点触控 opengl iphone 游戏几个星期了。就在昨天,它还在我的测试硬件(iPhone 4)上正确构建并运行。但是当我昨天加载该项目时,它给了我编译器错误:
Framework 'Mono for iPhone' not Installed.
我想不出任何原因,我没有更改我的系统或源代码。幸运的是,Monodevelop 已经用最新 api 下载的下载链接来骚扰我。我安装了,错误消失了。但相反,我现在在应用程序启动时出现运行时错误 http://screencast.com/t/EXyNqqhNoEsu :
System.ExecutionEngineException has been thrown. Attempting to JIT compile method ... FirstOrDefault ... while running with --aot-only.
尝试创建新的 DataContractSerializer 来加载某些 XML 设置时会发生这种情况:http://screencast.com/t/4SDzU5ygg
这迫使我第一次更改应用程序项目选项下的链接器行为设置。它被设置为“不链接”,就像以前一样。当我切换到“仅链接 SDK 程序集”时,它运行时不会出现上述异常。
这太好了,问题得到了解决,只是在这种模式下编译和部署到手机需要花费近半个小时(!)。构建输出位于“Linking SDK only for assembly...”。这是正常的吗?我认为我无法在构建时间这么长的情况下保持理智。即使是“不链接”也需要大约五分钟,当您尝试排除故障时,这是一个令人疲惫不堪的速度。
重申一下,这段代码连续几周每天都在工作,据我所知,其工作状态没有发生改变。有谁知道为什么现在会出现此错误,以及继续使用“不链接”选项的解决方案是什么?
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.com/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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于某种原因 MonoDevelop 无法找到您的 MonoTouch 安装。我无法说出原因,但重新启动 MonoDevelop 并检查 SDK 位置 的 MD 首选项(如果未找到 MonoTouch,则修复路径)将是尝试的最佳选择。
当选择“不链接”链接器选项时,MonoTouch 4.2[.1] 有时会抛出 ExecutionEngineException。此错误已修复,并将成为 MonoTouch 未来版本的一部分。
FWIW 链接 SDK 程序集是默认设置,应始终用于设备构建。链接器将生成小得多的应用程序,并且在大多数情况下还允许更快构建(因为链接器可以比 AOT 编译器处理这 100kb 的速度快 100kb)。
如果您遇到链接器花费很长时间的情况,那么您的项目中就会出现问题(或者至少是奇怪的)。请花时间在 http://bugzilla.xamarin.com 填写错误报告,以便我们调查原因需要这么长时间。
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.
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.