title: MSMQ - Generic System.Messaging.MessageQueueException - no error message
body: <p>We have an application in which there are three separate MSMQ queues we are peeking/receiving asynchronously. These queues are continuously peeked(every 2s) to check for new messages. If one is peeked successfully it receives the message to pull it out of the queue. 
  The queues are private on a remote server and the client connects on a path like so: 
      <code>FormatName:DIRECT=OS:servername\Private$\qname</code> </p>
  
  <p>Recently one of our environments started receiving MessageQueueExceptions unceasingly while trying to peek the queues. The peek code looks something like this: </p>
  
  <pre><code>   var messageQueue = new System.Messaging.MessageQueue(path);
     message = _messageQueue.Peek(_config.QueFetchTimeout);
  </code></pre>
  
  <p>The exception is as follows:</p>
  
  <pre><code>System.Messaging.MessageQueueException (0x80004005)
     at System.Messaging.MessageQueue.MQCacheableInfo.get_ReadHandle()
     at System.Messaging.MessageQueue.StaleSafeReceiveMessage(UInt32 timeout, Int32 action, MQPROPS properties, NativeOverlapped* overlapped, ReceiveCallback receiveCallback, CursorHandle cursorHandle, IntPtr transaction)
     at System.Messaging.MessageQueue.ReceiveCurrent(TimeSpan timeout, Int32 action, CursorHandle cursor, MessagePropertyFilter filter, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType)
     at System.Messaging.MessageQueue.Peek(TimeSpan timeout)
     at Run() in C:\workspace\ourclass.cs:line 53
  </code></pre>
  
  <p>Additional member values:</p>
  
  <ol>
  <li>ErrorMessage: (Empty)</li>
  <li>MessageQueueErrorCode: Generic</li>
  <li>ErrorCode: -2147467259</li>
  </ol>
  
  <p>Notice that there is no error message for this exception. I haven't been able to find anything on what this exactly entails; it just appears to be a general failure. </p>
  
  <p>Another important note is that this error only seems to occur when there are multiple threads executing peeks on their separate queues. When there is only one queue running continuously the peeks are successful. Other environments are not seeing this issue. This issue has also arisen out of the blue without any changes to the queuing code. </p>
  
  <p>No errors in the OS's event log. 
  EnableConnectionCache is false</p>
  
  <p>The machine works perfectly with local private queues. It only seems to be an issue when they are remote.</p>
  
  <p>Windows 2012R2 MSMQ: 6.3</p>
  
  <p>Are there any ideas as to what have may caused this? </p>
  
  <p><strong>Update:</strong></p>
  
  <p>As OP stated the issue does not exist when only a single thread is running peeks in the application. So the next obvious thing was to lock the peek operation between all threads. Indeed this workaround solved the issue however I am still looking for an answer as to why the peek could not handle the multiple threads on one particular machine running Windows 2012R2 and why the error was so uninformative</p>