2012-08-14 3 views
5

MonoTouchでadvertisesサポートクラッシュ:AsParallelは、このコードスニペットを持つ同社のウェブサイト上の<code>AsParallel</code>ためMonoTouchでアプリ

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(); 

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.

を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. 
+0

@James:AFAIK - aot-onlyは、JITがAppleによって禁止されているため、実際のiOSデバイスで可能な唯一のモードです。 –

+0

これはおそらくバグであり、ここに報告し、それを再現するための簡単なプロジェクトを添付してください:http://bugzilla.xamarin.com – jonathanpeppers

答えて

4

This is a known limitation with MonoTouch and generics - あなたが構造で作業しているので、この場合にはそれがあります。

あなたの代わりにオブジェクトを使用する場合、それが動作するはずです:私たちは、これらの制限のいくつかの修正に取り組んでいる

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

をので、あなたが私たちのためのサンプルプロジェクトにしてバグレポートを提出することができれば、それはいいだろう実際にこの日を修正することが可能かどうかを見てみましょう。

+1

答えをありがとう。私は今構造が責められることを理解しています。 –

関連する問題