I'm wondering if anyone of you can help me with this scenario. I have a multithreaded program that uses client server socket connections.
public static object _mLock = new object();
private void OnReceive_FromServer(IAsyncResult iar)
{
lock (_mLock)
{
try {
// some code
catch(Exception e) {
Log(e);
}
}
}
In this method I get NullReferenceException on _mLock public static field for some reason I can't explain. Can anyone of you explain how and what object can apparently be null here on line 5?
I've tried to search the internet for this particular problem but I get thousands of results not having a similar scenario...