MonoTouch的对LINQ查询炸毁时利用设备构建 [英] Monotouch blows up on LINQ query when using device builds
问题描述
这是我得到的错误:
| mscorlib程序| |试图JIT编译的方法'System.Linq.OrderedEnumerable`1:的GetEnumerator()'与--aot只运行,而
| mscorlib | | Attempting to JIT compile method 'System.Linq.OrderedEnumerable`1:GetEnumerator ()' while running with --aot-only.
从我读过它看起来。像编译器不包括在此情况下的GetEnumerator的方法,即代码需要因为LINQ的。什么是行动对于确保该编译器包括了正确的课程?
From what I've read it looks like the compiler doesn't include a method in this case "GetEnumerator", that the code needs because of LINQ. What is the correct course of action for making sure the compiler includes it?
几乎每个人都在运行到这一点,我在网上找到刚刚摆脱了LINQ查询,并与寿命上移动,但我厌倦了重写我的代码当这样的事情弹出。另外我不知道到底是哪LINQ查询导致了问题,我慢慢地我的代码去,并重新编写所有的LINQ查询,直到我找到它。
Pretty much everyone that runs into this that I've found online just gets rid of the linq query and moves on with life but I am tired of re-writing my code when something like this pops up. Also I'm not sure exactly which linq query is causing the issue and I'm slowly going through my code and re-writing all the linq queries until I find it.
推荐答案
发现问题的代码行:
// currentDates是一个List< DateTime的>
回报(从DT在currentDates排序依据dt.Date升序选择DT).ToList();
我改成了用
CurrentDates.Sort()
和避免调用一个没有得到AOT-ED的GetEnumerator的。不再炸毁。
and that avoided calling the GetEnumerator that wasn't getting AOT-ed. No longer blows up.
这篇关于MonoTouch的对LINQ查询炸毁时利用设备构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!