Type Reason ArgumentNullException obj is null. System.Threading.SynchronizationLockException The current thread does not own the lock for the specified object.
The calling thread must own the lock on the obj parameter. If the calling thread owns the lock on the specified object, and has made an equal number of Exit and Monitor.Enter(object) calls for the object, then the lock is released. If the calling thread has not invoked Exit as many times as Enter, the lock is not released.
If the lock is released and other threads are in the ready queue for the object, one of the threads acquires the lock. If other threads are in the waiting queue waiting to acquire the lock, they are not automatically moved to the ready queue when the owner of the lock calls Exit. To move one or more waiting threads into the ready queue, call Monitor.Pulse(object) or Monitor.PulseAll(object) before invoking Exit.