MauiHybridWebView icon indicating copy to clipboard operation
MauiHybridWebView copied to clipboard

Calling a C# async method from JavaScript does not wait for result

Open mstrong64 opened this issue 6 months ago • 0 comments

To duplicate this issue change an async example in the demo to actually be an async method. e.g.:

public **async Task<object>** GetObjectResponse()
{
    _mainPage.WriteToLog($"I'm a round trip .NET method called from JavaScript getting an object without any input parameters");
    **await Task.Delay(2000);**
    return new List<object>()
    {
        new { Name = "John", Age = 42 },
        new { Name = "Jane", Age = 39 },
        new { Name = "Sam", Age = 13 },
    };
}

The object will not be returned to the JS.

I have a fix if you're interested in a PR, but I guess this issue is being fixed for .net 9?

mstrong64 avatar Aug 17 '24 01:08 mstrong64