How to Debug an Async Block in F# with Visual Studio 2019

Viewed 33

I am having trouble getting all the info I need while debugging an F# async block in Visual Studio

I can debug, breakpoint and step through the following code - but I cannot get the values of a variable after executing a line.

For example - I execute past the line that starts with: let! emailField =

and I cannot see the variable emailField anywhere. Any ideas appreciated.

let getLoggedInBrowser(email:string, password: string, initialPageUrl: string) =
    async {
    let! playwright = Async.AwaitTask(Playwright.CreateAsync())
    let! browser = Async.AwaitTask(playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions(Headless=false)))
    let! page = Async.AwaitTask(browser.NewPageAsync())
    do! Async.AwaitTask(page.GotoAsync("https://go.xero.com/Dashboard/")) |> Async.Ignore
    do! Async.AwaitTask(page.WaitForSelectorAsync("#xl-form-email")) |> Async.Ignore
    let! emailField = Async.AwaitTask(page.FillAsync("#xl-form-email",email))
    do! Async.AwaitTask(page.FillAsync("#xl-form-password",password))
    do! Task.WhenAll(page.ClickAsync("#xl-form-submit"),page.WaitForNavigationAsync()) |> Async.AwaitTask
    do! page.GotoAsync(initialPageUrl) |> Async.AwaitTask |>  Async.Ignore
    return playwright, browser , page
    }
0 Answers
Related