Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 单声道:并行问题。例如_C#_.net 3.5_Mono_Task Parallel Library_Parallel Extensions - Fatal编程技术网

C# 单声道:并行问题。例如

C# 单声道:并行问题。例如,c#,.net-3.5,mono,task-parallel-library,parallel-extensions,C#,.net 3.5,Mono,Task Parallel Library,Parallel Extensions,我使用的是任务.Parallel类,该类来自Microsoft反应式扩展(.NET 3.5库,而不是.NET 4库,因为我的应用程序运行在3.5上)。在.NET上一切正常,但当我在Mono(Linux上为2.10.5)中运行它时,调用Parallel.For()方法时会引发异常: System.Threading.Tasks.TaskSchedulerException: TaskSchedulerException_ctor_DefaultMessage ---> System.En

我使用的是
任务.Parallel
类,该类来自Microsoft反应式扩展.NET 3.5库,而不是.NET 4库,因为我的应用程序运行在3.5上)。在.NET上一切正常,但当我在Mono(Linux上为2.10.5)中运行它时,调用
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
System.Threading.Tasks.TaskSchedulerException:TaskSchedulerException\u ctor\u DefaultMessage
--->System.EntryPointNotFoundException:SwitchToThread
at(包装器管理到本机)System.Threading.Platform:SwitchToThread()
位于System.Threading.Platform.Yield()[0x00000]的位置:0
在System.Threading.ManualResetEventSlim.Wait(Int32毫秒计时,CancellationToken CancellationToken)[0x00000]中:0
在0中的System.Threading.ManualResetEventSlim.Wait()[0x00000]处
在System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler调度程序)[0x00000]中:0
---内部异常堆栈跟踪的结束---
在System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler调度程序)[0x00000]中:0
在:0中的System.Threading.Tasks.Task.RunSynchronously(System.Threading.Tasks.TaskScheduler调度器)[0x00000]处
在System.Threading.Tasks.Parallel.ForWorker[Object](Int32 fromInclusive,Int32 toExclusive,System.Threading.Tasks.ParallelOptions ParallelOptions,System.Action`1 body WithState,System.Func`4 bodyWithLocal,System.Func`1 localInit,System.Action`1 localFinally)[0x00000]中:0

我在网上找不到任何关于这个异常的资源,所以我有点卡住了。有什么建议吗?3.5版任务并行库是否在Mono上运行?

您使用的是哪一版本的反应式扩展库?(如果它是任何控制台,可能与此无关,但我从这里安装了PFX库:在windows上的VS中使用命令Install Package TaskParallelLibrary(so版本1.0.2856.0),构建了一个简单的并行程序。对于控制台应用程序,然后将exe和DLL复制到运行mono 2.10.9的Mac上,运行正常)@kmp:我使用的是同一个版本,也是通过NuGet。它在我的LinuxMint虚拟机上运行没有问题,但在上网本LinuxMint上出现故障。在用户的Mac电脑上也会出现故障(也是mono 2.10.9)。我将使用越来越复杂的并行程序进行更多的测试。对于循环,我将看看如何进行。谢谢2015年Unity3d也出现了同样的问题(这并不令人惊讶,因为Unity仅仅在原则上是跟不上时代的步伐的)。有什么解决办法吗?