Skip to content

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

@mstrong64

Description

@mstrong64

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions