queue.Send("A test message 1.") will trigger resource allocation operations on the queue, close the queue before delete and you will get the expected exception:
// Local public queue.
string queuePath = ".\\TestQueue";
System.Messaging.MessageQueue.Create(queuePath);
System.Messaging.MessageQueue queue = new System.Messaging.MessageQueue(queuePath, false, false);
queue.Send("A test message 1.");
queue.Close();
System.Messaging.MessageQueue.Delete(queuePath);
// an exception expected!!!
queue.Send("A test message 2.");
Thanks,
Eric
Please remember to mark helpful replies as answers and unmark them if they provide no help.