private bool IsAnyBlockingActivityInScope(WorkflowExecutionContext workflowExecutionContext, string scopeActivityId) { // Get all blocking activity IDs. var blockingActivityIds = workflowExecutionContext.WorkflowInstance.BlockingActivities.Select(x => x.ActivityId).ToHashSet(); // For each blocking activity, check if it is within the current scope (taking the first one). foreach (var blockingActivityId in blockingActivityIds) { var inboundActivityIds = new[] { blockingActivityId }.Concat(workflowExecutionContext.GetInboundActivityPath(blockingActivityId)).ToHashSet(); if (inboundActivityIds.Contains(scopeActivityId)) { return(true); } } return(false); }