Intermittent errors such as following when using MSMQ .NET (1.1)
Index was outside the bounds of the arraySpecified cast is not valid System.Messaging.Interop.MessagePropertyVariants.Lockget_Label msmq exceptionIndex was outside the bounds of the array MessageQueue.Send
These can occur randomly if you have 1 instance of message queue component and multiple references to it (for example in multiple threads) with [...]

In testing you might want to throw a manual MessageQueueingException to test the functionality of your exception handling. As it’s not possible to create an exception object the following can be used to throw an exception:
ReceiveById(”this is a made up id to force an exception”)
As long as no message exists that matches this you will [...]

With over 15 years experience, Jason Roberts is a former 5-time Microsoft .NET MVP, freelance developer, writer, and Pluralsight course author. He has written multiple books and is an open source contributor. In addition to enterprise software development, he has also designed and developed both Windows Phone and Windows Store apps.