MonoTouch在其网站上通过以下代码片段宣传支持:AsParallel
from item in items.AsParallel ()
let result = DoExpensiveWork (item)
select result;
但是,即使是一个微不足道的示例也会使我的应用程序崩溃:
var items = new [] { 1, 2, 3 };
var twice = (
from x in items.AsParallel()
select 2 * x
).ToArray();
我知道 MonoTouch 不能处理虚拟泛型方法,但 PLINQ 不应该工作吗?
我在做什么错了?
MonoTouch 版本是 5.3.5。
同样适用于Parallel.ForEach
:
System.AggregateException: One or more errors occured ---> System.Exception:
Attempting to JIT compile method 'System.Threading.Tasks.Parallel:<ForEach`1>m__36<int> ()' while running with --aot-only.
See http://docs.xamarin.com/ios/about/limitations for more information.