diff --git a/src/core/Elsa.Abstractions/Services/Models/LoadWorkflowContext.cs b/src/core/Elsa.Abstractions/Services/Models/LoadWorkflowContext.cs index 441be9b9b..d26c84d89 100644 --- a/src/core/Elsa.Abstractions/Services/Models/LoadWorkflowContext.cs +++ b/src/core/Elsa.Abstractions/Services/Models/LoadWorkflowContext.cs @@ -13,7 +13,7 @@ namespace Elsa.Services.Models public WorkflowExecutionContext WorkflowExecutionContext { get; } public IWorkflowBlueprint WorkflowBlueprint => WorkflowExecutionContext.WorkflowBlueprint; public WorkflowInstance WorkflowInstance => WorkflowExecutionContext.WorkflowInstance; - public Type ContextType => WorkflowBlueprint.ContextOptions!.ContextType; + public Type? ContextType => WorkflowBlueprint.ContextOptions?.ContextType; public string ContextId => WorkflowInstance.ContextId!; } } \ No newline at end of file diff --git a/src/core/Elsa.Core/Services/WorkflowContextManager.cs b/src/core/Elsa.Core/Services/WorkflowContextManager.cs index 7e01d5ae9..5aa0f2772 100644 --- a/src/core/Elsa.Core/Services/WorkflowContextManager.cs +++ b/src/core/Elsa.Core/Services/WorkflowContextManager.cs @@ -21,7 +21,7 @@ namespace Elsa.Services public async ValueTask LoadContext(LoadWorkflowContext context, CancellationToken cancellationToken = default) { - var provider = GetRefresher(context.ContextType); + var provider = context.ContextType != null ? GetRefresher(context.ContextType) : null; return provider == null ? null : await provider.LoadAsync(context, cancellationToken); }