protected virtual void Dispose(bool disposing) { if (System.Threading.Interlocked.Exchange(ref _disposed, 1) == 0) { if (disposing) { if (!_cts.IsCancellationRequested) { _cts.Cancel(); } _mq.ReceiveCompleted -= OnMQReceiveCompleted; _mq.Close(); _mq.Dispose(); } } }