I use the class Task.Parallelfrom Microsoft Reactive Extensions ( .NET 3.5 library ), and not those from .NET 4, since my application 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 the method is called 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
I could not find any resources on the Internet covering this exception, so I was kind of stuck. Any suggestions? Is there a parallel Task for 3.5 library to run in Mono?
source
share