File tree Expand file tree Collapse file tree
src/FSharpPlus/Extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -487,7 +487,7 @@ module Task =
487487 let inline recover ( [<InlineIfLambda>] mapper : exn -> 'T ) ( source : Task < 'T >) : Task < 'T > =
488488 let source = nullArgCheck ( nameof source) source
489489
490- tryWith ( fun () -> source) ( mapper >> Task.FromResult)
490+ tryWith ( fun () -> source) ( mapper >> Task.FromResult)
491491 #else
492492 let inline recover ( mapper : exn -> 'T ) ( source : Task < 'T >) : Task < 'T > =
493493 raiseIfNull " source" source
@@ -499,7 +499,17 @@ module Task =
499499 /// <param name =" mapper " >Mapping function from exception to exception.</param >
500500 /// <param name =" source " >The source task.</param >
501501 /// <returns >The resulting task.</returns >
502+ #if ! NET45
503+ let inline mapError ( [<InlineIfLambda>] mapper : exn -> exn ) ( source : Task < 'T >) : Task < 'T > =
504+ #else
502505 let mapError ( mapper : exn -> exn ) ( source : Task < 'T >) : Task < 'T > =
506+ #endif
507+ #if NET5_ 0_ OR_ GREATER
508+ let tcsOptions ' = TaskCreationOptions.RunContinuationsAsynchronously
509+ #else
510+ let tcsOptions ' = ()
511+ #endif
512+
503513 #if ! NET45
504514 let source = nullArgCheck ( nameof source) source
505515 #else
@@ -511,7 +521,7 @@ module Task =
511521 | Faulted exn -> FromExceptions ( AggregateException ( mapper exn))
512522 | _ -> source
513523 else
514- let tcs = TaskCompletionSource< 'T> tcsOptions
524+ let tcs = TaskCompletionSource< 'T> tcsOptions'
515525 let k = function
516526 | Succeeded r -> tcs.SetResult r
517527 | Faulted aex -> tcs.SetException ( AggregateException ( mapper aex)) .InnerExceptions
Original file line number Diff line number Diff line change @@ -407,7 +407,13 @@ module ValueTask =
407407 | Faulted exn -> FromExceptions ( AggregateException ( mapper exn))
408408 | _ -> source
409409 else
410- let tcs = TaskCompletionSource< 'T> tcsOptions
410+ #if NET5_ 0_ OR_ GREATER
411+ let tcsOptions ' = TaskCreationOptions.RunContinuationsAsynchronously
412+ #else
413+ let tcsOptions ' = ()
414+ #endif
415+
416+ let tcs = TaskCompletionSource< 'T> tcsOptions'
411417 let k = function
412418 | Succeeded r -> tcs.SetResult r
413419 | Faulted aex -> tcs.SetException ( AggregateException ( mapper aex)) .InnerExceptions
You can’t perform that action at this time.
0 commit comments