public Activity GetWorkflowDefinition() { while (true) { WorkflowExecutor executor = _runtime.Load(this); if (executor.IsInstanceValid) { try { // Make sure to get the clone here since the // definition is mutable and shared across all // instances. return(executor.GetWorkflowDefinitionClone("")); } catch (InvalidOperationException) { if (executor.IsInstanceValid) { throw; } } } } }