Q: C# Monitor.Enter not lock if Object lies within another Object I thought Monitor.Enter works on references to objects as long as the reference to the object or the object itself does not change.
So here is my simple case, I have a class called QueueManager which has an Queue in it. I'm using this object Queue to lock using Monitor.Lock before manipulating the queue. I tried a simple test of calling Monitor.Lock on the queue object and it fails. Any idea why?
public class QueueManager
{
    private List<ConversionJob> _jobQueue = new List<ConversionJob>();

    public QueueManager()
    {
    }

    public List<ConversionJob> Queue
    { get { return _jobQueue; } }
}

public class Main
{
    private QueueManager qMgr = new QueueManager();

    public Main()
    {
        try
        {
            Monitor.Enter(qMgr.Queue);
            throw new Exception();
        }
        catch (Exception)
        {
            Monitor.Enter(qMgr.Queue);
        }
    }
}

This doesn't DEADLOCK!! I can't understand why it doesn't deadlock. I tried this because I suspected the locks were being taken so I put this test code in and I'm surprised.

A: Monitors are re-entrant - one thread can own a monitor multiple times. The monitor is only unlocked (available for another thread to acquire it) when Exit has been called the same number of times as Enter.
From the docs for Exit:

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 Enter 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.


A: 
This doesn't DEADLOCK!! 

That is because both calls to Enter() are made from the same thread. Monitor is recursive-reentrant.
