private void EnsureActivityInstrumented(System.Activities.ActivityInstance instance, bool primeCurrentInstance) { if (this.debugManager == null) { Stack<System.Activities.ActivityInstance> stack = new Stack<System.Activities.ActivityInstance>(); while (instance.Parent != null) { stack.Push(instance); instance = instance.Parent; } Activity root = instance.Activity; this.debugManager = new DebugManager(root, "Workflow", "Workflow", "DebuggerThread", false, this.host, stack.Count == 0); if (stack.Count > 0) { this.debugManager.IsPriming = true; while (stack.Count > 0) { System.Activities.ActivityInstance instance2 = stack.Pop(); this.debugManager.OnEnterState(instance2); } if (primeCurrentInstance) { this.debugManager.OnEnterState(instance); } this.debugManager.IsPriming = false; } } }
public void WorkflowCompleted() { if (this.debugManager != null) { this.debugManager.Exit(); this.debugManager = null; } }
// Lazy instrumentation. Parameter primeCurrentInstance specify whether priming (if needed) // is done up to the current instance. Set this to true when calling this from an // "...Completed" (exit state). private void EnsureActivityInstrumented(ActivityInstance instance, bool primeCurrentInstance) { if (this.debugManager == null) { // Workflow has not been instrumented yet. // Finding rootInstance and check all referred sources. Stack <ActivityInstance> ancestors = new Stack <ActivityInstance>(); while (instance.Parent != null) { ancestors.Push(instance); instance = instance.Parent; } Activity rootActivity = instance.Activity; // Do breakOnStartup only if debugger is attached from the beginning, i.e. no // priming needed. This specified by change the last parameter below to: // "(ancestors.Count == 0)". this.debugManager = new DebugManager(rootActivity, "Workflow", "Workflow", "DebuggerThread", false, this.host, ancestors.Count == 0); if (ancestors.Count > 0) { // Priming the background thread this.debugManager.IsPriming = true; while (ancestors.Count > 0) { ActivityInstance ancestorInstance = ancestors.Pop(); this.debugManager.OnEnterState(ancestorInstance); } if (primeCurrentInstance) { this.debugManager.OnEnterState(instance); } this.debugManager.IsPriming = false; } } }
// Lazy instrumentation. // Parameter primeCurrentInstance specify whether priming (if needed) is done // up to the current instance. Set this to true when calling this from an "...Completed" // (exit state). void EnsureActivityInstrumented(ActivityInstance instance, bool primeCurrentInstance) { if (this.debugManager == null) { // Workflow has not been instrumented yet. // Finding rootInstance and check all referred sources. Stack<ActivityInstance> ancestors = new Stack<ActivityInstance>(); while (instance.Parent != null) { ancestors.Push(instance); instance = instance.Parent; } Activity rootActivity = instance.Activity; // Do breakOnStartup only if debugger is attached from the beginning, i.e. no priming needed. // This specified by change the last parameter below to: "(ancestors.Count == 0)". this.debugManager = new DebugManager(rootActivity, "Workflow", "Workflow", "DebuggerThread", false, this.host, ancestors.Count == 0); if (ancestors.Count > 0) { // Priming the background thread this.debugManager.IsPriming = true; while (ancestors.Count > 0) { ActivityInstance ancestorInstance = ancestors.Pop(); this.debugManager.OnEnterState(ancestorInstance); } if (primeCurrentInstance) { this.debugManager.OnEnterState(instance); } this.debugManager.IsPriming = false; } } }