AsParallel crashing a MonoTouch app

Viewed 522

MonoTouch advertises support for AsParallel on its website with this code snippet:

from item in items.AsParallel ()
   let result = DoExpensiveWork (item)
   select result;

However, even a trivial sample crashes my app:

 var items = new [] { 1, 2, 3 };
 var twice = (
        from x in items.AsParallel()
        select 2 * x
    ).ToArray();

System.ExecutionEngineException has been thrown. Attempting to JIT compile method 'System.Linq.Parallel.QueryNodes.WrapHelper:<Wrap<code>1>m__4A<int>(System.Collections.Generic.IEnumerator</code>1<int>)' while running with --aot-only.

I know MonoTouch can't handle virtual generic methods but isn't PLINQ supposed to work?
What is it wrong that I am doing?

MonoTouch version is 5.3.5.

Same goes for 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.
1 Answers
Related