【发布时间】:2013-05-31 09:44:23
【问题描述】:
我有一个使用单例类 ThreadQueue<T> 的 Windows 服务。当服务启动时,它会调用 ThreadQueue<string>.Start() 这个类,然后接受并将并发限制为可配置线程数的任务。
ThreadQueue<string>.Start() 只在服务启动时调用一次。
有时,在服务运行几个小时后,我会收到以下异常:
Application: myservice.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
at Apollo.Business.Framework.Threading.ThreadQueue.ThreadQueue`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start()
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()
System.__Canon 是什么?是什么让这个调用将 this 作为类型参数传入?
谁能解释一下?
【问题讨论】:
-
你试过在
Debug模式下编译吗? -
已经是了,你问这个干嘛?
标签: c# multithreading c#-4.0 singleton