System.ArgumentNullException in System.Threading.Monitor.Enter

时光毁灭记忆、已成空白 提交于 2019-12-11 09:16:23

问题


I've got a code like this:

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

How can this be possible? Considering the SLock is shared, never touched from anywhere else?


回答1:


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.




回答2:


Maybe similar problem - System.ArgumentNullException in ResourceManager.GetString internals.



来源:https://stackoverflow.com/questions/1655182/system-argumentnullexception-in-system-threading-monitor-enter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!