Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.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# Rx运行时出错_C#_.net_Debugging_System.reactive - Fatal编程技术网

C# Rx运行时出错

C# Rx运行时出错,c#,.net,debugging,system.reactive,C#,.net,Debugging,System.reactive,我开发了一个组件,它使用反应式扩展来处理来自串行端口的数据。当我运行使用我的组件的应用程序时,该应用程序停止工作,并在应用程序事件日志中发现以下错误: Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ArgumentOutOfRangeException Stack: at System.Re

我开发了一个组件,它使用反应式扩展来处理来自串行端口的数据。当我运行使用我的组件的应用程序时,该应用程序停止工作,并在应用程序事件日志中发现以下错误:

Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ArgumentOutOfRangeException Stack: at System.Reactive.ScheduledObserver`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Dispatch(System.Reactive.Disposables.ICancelable) at System.Reactive.Concurrency.Scheduler.b__32(System.Action`1, System.Reactive.Disposables.ICancelable) at System.Reactive.Concurrency.NewThreadScheduler+c__DisplayClass3`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].b__2() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart() 框架版本:v4.0.30319 描述:由于未处理的异常,进程已终止。 异常信息:System.ArgumentOutOfRangeException 堆栈: 在System.Reactive.ScheduledObjector`1[[System.\u Canon,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089]]调度(System.Reactive.Disposables.ICancelable) 在System.Reactive.Concurrency.Scheduler.b_uu32(System.Action`1,System.Reactive.Disposables.icancellable) 在System.Responsive.Concurrency.NewThreadScheduler+c_uuuDisplayClass3`1[[System.uuu Canon,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089].b_uuu2() 位于System.Threading.ThreadHelper.ThreadStart\u上下文(System.Object) 位于System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,布尔值) 在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object,布尔值) 在System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object)上运行 位于System.Threading.ThreadHelper.ThreadStart()处
我的代码都没有出现在堆栈跟踪中,所以我不知道如何调试它。有人能提供一些建议吗?

Whoops的意思是作为评论而不是回答。您可能不会在堆栈上看到它,因为它在NewThreadScheduler上,它是在不同的线程堆栈上异步发生的。我想异常会以某种方式被封送回主线程。无论如何,正如我在另一篇评论中提到的,我似乎已经发现了问题。。。我试图等待一个带有负超时的ManualResetEvent(实际上是TimeSpan.MinValue,出于某种原因,我认为它应该是0,但实际上是一个很大的负数)。顺便说一句,我也不建议在
onNext
方法中引入额外的同步性。它会很快变得一团糟,通常不建议从观察者那里扔掉。您能展示一下您正在运行的代码吗?仅仅显示异常和堆栈是不够的。