我正在使用 Microsoft Reactive Extensions 中的Task.Parallel
类( .NET 3.5库,而不是来自.NET 4的类,因为我的应用程序正在运行3.5)。在.NET上一切正常,但是当我在Mono(2.10.5,在Linux上)运行它时,它会在调用Parallel.For()
方法时抛出异常:
System.Threading.Tasks.TaskSchedulerException: TaskSchedulerException_ctor_DefaultMessage
---> System.EntryPointNotFoundException: SwitchToThread
at (wrapper managed-to-native) System.Threading.Platform:SwitchToThread ()
at System.Threading.Platform.Yield () [0x00000] in <filename unknown>:0
at System.Threading.ManualResetEventSlim.Wait (Int32 millisecondsTimeout, CancellationToken cancellationToken) [0x00000] in <filename unknown>:0
at System.Threading.ManualResetEventSlim.Wait () [0x00000] in <filename unknown>:0
at System.Threading.Tasks.Task.InternalRunSynchronously (System.Threading.Tasks.TaskScheduler scheduler) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.InternalRunSynchronously (System.Threading.Tasks.TaskScheduler scheduler) [0x00000] in <filename unknown>:0
at System.Threading.Tasks.Task.RunSynchronously (System.Threading.Tasks.TaskScheduler scheduler) [0x00000] in <filename unknown>:0
at System.Threading.Tasks.Parallel.ForWorker[Object] (Int32 fromInclusive, Int32 toExclusive, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`1 body, System.Action`2 bodyWithState, System.Func`4 bodyWithLocal, System.Func`1 localInit, System.Action`1 localFinally) [0x00000] in <filename unknown>:0
我在Web上找不到任何覆盖此异常的资源,所以我有点卡住了。有什么建议? 3.5的任务并行库是否在Mono上运行?