System.ArgumentNullException在System.Threading.Monitor.Enter [英] System.ArgumentNullException in System.Threading.Monitor.Enter
问题描述
我有一个code是这样的:
I've got a code like this:
我们的一些客户接受System.ArgumentNullException在System.Threading.Monitor.Enter在以下code座的:
Some of our clients receiving "System.ArgumentNullException in System.Threading.Monitor.Enter" in the following code block:
Public Class CheckStuff
Private Shared SLock As New Object
Public Sub GetIt()
Synclock SLock
DoSomething()
End Synclock
End Sub
End Class
这怎么可能呢?考虑到 SLOCK
是共享的,永远不会从其他地方感动?
How can this be possible? Considering the SLock
is shared, never touched from anywhere else?
推荐答案
我的猜测是,你已经简单化样品code - 它必须从别的东西被触动,使之没有
。或者,你的锁定方法被调用之前 CheckStuff
完成初始化。堆栈跟踪将是有益的。
My guess is that you've oversimplified your sample code - it must be touched from something else to make it Nothing
. Or, your locking method is called before CheckStuff
has finished initializing. A stack trace would be helpful.
这篇关于System.ArgumentNullException在System.Threading.Monitor.Enter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!