FSharp.Control.FusionTasks icon indicating copy to clipboard operation
FSharp.Control.FusionTasks copied to clipboard

Use fixed way of awaiting tasks and asyncs

Open xperiandri opened this issue 2 years ago • 0 comments

Describe the bug

    member this.AsyncAcquireTokenInteractively (uiThread, correlationId) = asyncResult {
        do! Async.SwitchToContext uiThread
        let builder =
            pca.AcquireTokenInteractive(options.Scopes)
                .WithCorrelationId(correlationId)
        if not (isNull configureInteractive) then configureInteractive.Invoke(builder)
        try return! builder.ExecuteAsync() // FSharp.Control.FusionTasks is used not to write |> Async.AwaitTask
        with :? MsalClientException as ex -> return! Error ex.ErrorCode
    }

Matching by the MsalClientException does not happen as it is wrapped by the AggregateException.

I propose not to use a corrected way of awaiting tasks and asyncs https://github.com/jet/FsKafka/blob/6c6186f822a221adf0ad06e8a44a392aa55aa8ec/src/FsKafka/Infrastructure.fs#L14

xperiandri avatar Nov 17 '21 22:11 xperiandri