From 1942e93ca0b576286af284429cea05f272d3af6b Mon Sep 17 00:00:00 2001 From: Eugene Auduchinok Date: Tue, 21 Apr 2026 10:23:17 +0200 Subject: [PATCH] Fix exceptions handling in task dynamic invocation --- src/FsToolkit.ErrorHandling/TaskOptionCE.fs | 3 +-- src/FsToolkit.ErrorHandling/TaskValueOptionCE.fs | 3 +-- src/FsToolkit.ErrorHandling/ValueTaskValueOptionCE.fs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/FsToolkit.ErrorHandling/TaskOptionCE.fs b/src/FsToolkit.ErrorHandling/TaskOptionCE.fs index ac058250..d3938c99 100644 --- a/src/FsToolkit.ErrorHandling/TaskOptionCE.fs +++ b/src/FsToolkit.ErrorHandling/TaskOptionCE.fs @@ -299,8 +299,7 @@ type TaskOptionBuilder() = // If the `sm.Data.MethodBuilder` has already been set somewhere else (like While/WhileDynamic), we shouldn't continue if sm.Data.IsTaskCompleted then () - - if step then + elif step then sm.Data.SetResult() else match sm.ResumptionDynamicInfo.ResumptionData with diff --git a/src/FsToolkit.ErrorHandling/TaskValueOptionCE.fs b/src/FsToolkit.ErrorHandling/TaskValueOptionCE.fs index 56a39b78..c46ec9e1 100644 --- a/src/FsToolkit.ErrorHandling/TaskValueOptionCE.fs +++ b/src/FsToolkit.ErrorHandling/TaskValueOptionCE.fs @@ -306,8 +306,7 @@ type TaskValueOptionBuilder() = // If the `sm.Data.MethodBuilder` has already been set somewhere else (like While/WhileDynamic), we shouldn't continue if sm.Data.IsTaskCompleted then () - - if step then + elif step then sm.Data.SetResult() else match sm.ResumptionDynamicInfo.ResumptionData with diff --git a/src/FsToolkit.ErrorHandling/ValueTaskValueOptionCE.fs b/src/FsToolkit.ErrorHandling/ValueTaskValueOptionCE.fs index dcd6b19e..0f4207c5 100644 --- a/src/FsToolkit.ErrorHandling/ValueTaskValueOptionCE.fs +++ b/src/FsToolkit.ErrorHandling/ValueTaskValueOptionCE.fs @@ -242,8 +242,7 @@ type ValueTaskValueOptionBuilder() = // If the `sm.Data.MethodBuilder` has already been set somewhere else (like While/WhileDynamic), we shouldn't continue if sm.Data.IsTaskCompleted then () - - if step then + elif step then sm.Data.SetResult() else match sm.ResumptionDynamicInfo.ResumptionData with