MicrosoftEdge / MicrosoftEdge/WebView2Feedback

App closes when calling async methods synchronously

Open
#3,139 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug tracked
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

          Hi, I made simple WPF example where we can reproduce the same exception and finally application closes.  

I think here is problem with binded async method and threading;
In my example I just call javascript method in DevTool console : window.chrome.webview.hostObjects.sync.customactions.GetString("aaa") that is binded to :

    [ClassInterface(ClassInterfaceType.AutoDual)]
[ComVisible(true)]
public class CustomActions
{
	public async Task<string> GetString(string str)
	{
		return await Task.Run(() => str);
	}
}

I used last nuget package version 1.0.1462.37. I can share this example.
If here is my configuration error please let me know how can properly bind and use asynchronouse method
regards :)

Originally posted by @53b4 in https://github.com/MicrosoftEdge/WebView2Feedback/issues/3062#issuecomment-1381484122

AB#43012834

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WPF reproduction and the DevTools call to window.chrome.webview.hostObjects.sync.customactions.GetString("aaa"), then inspect the CustomActions.GetString async method shown in the issue. Compare synchronous host-object invocation with the asynchronous return value; done means the application no longer closes and the supported binding or usage is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, javascript
Domain
api, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.