I'm using Task.Parallel
class from the Microsoft Reactive Extensions (the .NET 3.5 library, not the ones from .NET 4, since my app is running on 3.5). Everything works fine on .NET, but when I run it in Mono (2.10.5, on Linux), it throws an exception when calling the Parallel.For()
method:
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
I couldn't find any resources on the Web covering this exception, so I'm kind of stuck. Any suggestions? Does Task Parallel library for 3.5 run at all on Mono?