Exception on Monitor.Exit in C#
问题 This is a large multi-threaded project (which I didn't write) that I am fixing. The application hangs on some locks which I am tracking down. I went through and replaced all the "lock" statements with Monitor.TryEnter so I could set a wait period. I am occasionally getting an exception with the Monitor.Exit . The original style was private List<myClass> _myVar= new List<myClass>(); if (_myVar != null) { lock (_myVar) { _myVar = newMyVar; // Where newMyVar is another List<myClass> } } I