From 7c2a5b852522f8acab8225902aedd5f240f9ab7f Mon Sep 17 00:00:00 2001 From: Ben Mazzarol Date: Mon, 15 Jan 2024 19:39:15 +0800 Subject: [PATCH] feat: target 2.0 --- Icicle/Handles/ResultHandle.cs | 8 ++++---- Icicle/Icicle.csproj | 2 +- Icicle/TaskScope/TaskScope.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Icicle/Handles/ResultHandle.cs b/Icicle/Handles/ResultHandle.cs index 3e1bc44..6461d1d 100644 --- a/Icicle/Handles/ResultHandle.cs +++ b/Icicle/Handles/ResultHandle.cs @@ -55,7 +55,7 @@ public void ThrowIfFaulted(RunToken token) if (_task is { IsFaulted: true } ft) { - ExceptionDispatchInfo.Throw(ft.AsTask().Exception!.TryUnwrap()); + ExceptionDispatchInfo.Capture(ft.AsTask().Exception!.TryUnwrap()).Throw(); } } @@ -139,8 +139,8 @@ public T Value(RunToken token) case { IsCompletedSuccessfully: true } st: return st.Result; case { IsFaulted: true } ft: - ExceptionDispatchInfo.Throw(ft.AsTask().Exception!.TryUnwrap()); - return default; // unreachable + ExceptionDispatchInfo.Capture(ft.AsTask().Exception!.TryUnwrap()).Throw(); + return default!; // unreachable default: throw new TaskCanceledException(); } @@ -185,7 +185,7 @@ public void ThrowIfFaulted(RunToken token) if (_task is { IsFaulted: true } ft) { - ExceptionDispatchInfo.Throw(ft.AsTask().Exception!.TryUnwrap()); + ExceptionDispatchInfo.Capture(ft.AsTask().Exception!.TryUnwrap()).Throw(); } } diff --git a/Icicle/Icicle.csproj b/Icicle/Icicle.csproj index 876d27a..c39ccb5 100644 --- a/Icicle/Icicle.csproj +++ b/Icicle/Icicle.csproj @@ -25,7 +25,7 @@ - netstandard2.1 + netstandard2.0 enable enable true diff --git a/Icicle/TaskScope/TaskScope.cs b/Icicle/TaskScope/TaskScope.cs index ad8f890..f8fb6c1 100644 --- a/Icicle/TaskScope/TaskScope.cs +++ b/Icicle/TaskScope/TaskScope.cs @@ -139,7 +139,7 @@ public virtual async ValueTask Run( IsScopeFaulted = true; if (runOptions.ThrowOnFault) { - ExceptionDispatchInfo.Throw(e.TryUnwrap()); + ExceptionDispatchInfo.Capture(e.TryUnwrap()).Throw(); } } finally