diff Implab/Diagnostics/OperationContext.cs @ 93:dc4942d09e74 v2

improved tracing added the application components container MTComponentContainer.AppContainer
author cin
date Thu, 23 Oct 2014 01:13:57 +0400
parents 4c0e5ef99986
children 04d4c92d0f28
line wrap: on
line diff
--- a/Implab/Diagnostics/OperationContext.cs	Wed Oct 22 18:37:56 2014 +0400
+++ b/Implab/Diagnostics/OperationContext.cs	Thu Oct 23 01:13:57 2014 +0400
@@ -28,22 +28,32 @@
                     m_current = m_current.Parent;
                 else if (m_ownership)
                     m_current = LogicalOperation.EMPTY;
-                else
+                else {
+                    TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context");
                     detached = LogicalOperation.EMPTY;
+                }
+            } else {
+                TraceLog.TraceWarning("DetachLogicalOperation can't be applied in the current context");
             }
-            TraceLog.TraceWarning("EndLogicalOperation can't be applied in the current context");
+
             return detached;
         }
 
         public void EndLogicalOperation() {
             if (m_current != m_initial) {
                 m_current = m_current.Parent;
-            } else if (m_current != null && m_ownership) {
-                m_current = null;
+            } else if (m_current != LogicalOperation.EMPTY && m_ownership) {
+                m_current = LogicalOperation.EMPTY;
             } else {
                 TraceLog.TraceWarning("EndLogicalOperation can't be applied in the current context");
             }
         }
+
+        public void Leave() {
+
+            if ((m_ownership && m_current != LogicalOperation.EMPTY) || (!m_ownership && m_current != m_initial) )
+                TraceLog.TraceWarning("Trying to leave unfinished logical operation {0}", m_current.Name);
+        }
     }
 }