From 18f45fe241543ebb4bf9a19da92bb52b4420e4ec Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 15 Apr 2021 15:48:04 +0200 Subject: [PATCH] Fix workflow context type nullability --- .../Elsa.Abstractions/Services/Models/LoadWorkflowContext.cs | 2 +- src/core/Elsa.Core/Services/WorkflowContextManager.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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); }