您的位置:首页 > 其它

System.ExecutionEngineException: Attempting to JIT compile method System.Linq.Enumerable

2014-11-14 11:12 417 查看
关于JIT编译和AOT编译的问题。IOS下是不支持JIT动态编译的,所以如果程序有涉及JIT编译的都会无法执行。

在google查过说unity是不支持部分的Linq功能,如Sort方法。

但我在unity里面没有用到Linq的Sort方法,不过有用到OrderBy, FirstOrDefault, Where等。结果还是出现这个错误,

以防万一只能将所有用到的Linq方法重写。

如:类似System.Linq.Enumerable.Where的方法

public static IEnumerable<T> Filter<T>(this IEnumerable<T> source, Func<T, bool> predicate)    
{
if (source == null || predicate == null)
{
throw new ArgumentNullException();
}
return impl(source, predicate);
}

private static IEnumerable<T> impl<T>(IEnumerable<T> source, Func<T, bool> predicate)
{
foreach (T item in source)
{
if (predicate(item))
{
yield return item;
}
}
}


Since applications on the iPhone using Xamarin.iOS are compiled to static code, it is not possible to use any facilities that require code generation at runtime.

From: http://developer.xamarin.com/guides/ios/advanced_topics/limitations/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐