The invocation of Monitor.Wait(...)
is enclosed by at least two nested lock
statements. Since the wait instruction will only release the lock on the specified object, the lock on the other object is not freed. This constellation may therefore lead to a deadlock.
Do not make use of Monitor.Wait(...)
inside nested locks.