https://issues.apache.org/jira/browse/AMQNET-454

apply: https://issues.apache.org/jira/secure/attachment/12662486/Apache.NMS.AMQP-29-stop-sessions-before-connection.patch
diff --git a/src/main/csharp/Connection.cs b/src/main/csharp/Connection.cs
index 1d61690..2f55eda 100644
--- a/src/main/csharp/Connection.cs
+++ b/src/main/csharp/Connection.cs
@@ -122,9 +122,6 @@
         /// </summary>
         public void Stop()
         {
-            // Close qpidConnection
-            CheckDisconnected();
-
             // Administratively close NMS objects
             if (started.CompareAndSet(true, false))
             {
@@ -134,6 +131,9 @@
                     session.Stop();
                 }
             }
+
+            // Close qpidConnection
+            CheckDisconnected();
         }
         #endregion
 
diff --git a/src/main/csharp/MessageConsumer.cs b/src/main/csharp/MessageConsumer.cs
index 691f187..e45ca3b 100644
--- a/src/main/csharp/MessageConsumer.cs
+++ b/src/main/csharp/MessageConsumer.cs
@@ -116,13 +116,14 @@
             {
                 try
                 {
+                    Tracer.DebugFormat("Stop Consumer Id = " + ConsumerId);
                     qpidReceiver.Close();
                     qpidReceiver.Dispose();
                     qpidReceiver = null;
                 }
                 catch (Org.Apache.Qpid.Messaging.QpidException e)
                 {
-                    throw new NMSException("Failed to close session with Id " + ConsumerId.ToString() + " : " + e.Message);
+                    throw new NMSException("Failed to close consumer with Id " + ConsumerId.ToString() + " : " + e.Message);
                 }
             }
         }
diff --git a/src/main/csharp/MessageProducer.cs b/src/main/csharp/MessageProducer.cs
index af31358..7ac633a 100644
--- a/src/main/csharp/MessageProducer.cs
+++ b/src/main/csharp/MessageProducer.cs
@@ -109,7 +109,7 @@
                 }
                 catch (Org.Apache.Qpid.Messaging.QpidException e)
                 {
-                    throw new NMSException("Failed to close session with Id " + ProducerId.ToString() + " : " + e.Message);
+                    throw new NMSException("Failed to close producer with Id " + ProducerId.ToString() + " : " + e.Message);
                 }
             }
         }