Skip to content

Conversation

@rjmurillo
Copy link
Contributor

Issue: #2367

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

When calling WebView.InvokeScript from the UI thread, a deadlock may occur when the asynchronous task is captured within the UI context. Since each thread is waiting for the each other, the deadlock occurs.

What is the new behavior?

An attempt to move the thread execution to the thread pool causes a similar issue, so the task is moved to a message loop to keep the UI responsive while the task is completed.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Sample in sample app has been added / updated (for bug fixes / features)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

CC @PoulBak
Resolves #2367

When calling WebView.InvokeScript from the UI thread, a deadlock may occur when the asynchronous task is captured within the UI context. Since each thread is waiting for the each other, the deadlock occurs.

An attempt to move the thread execution to the thread pool causes a similar issue, so the task is moved to a message loop to keep the UI responsive while the task is completed.
@rjmurillo rjmurillo added reviewers wanted WebView 🖥️ WPF and WinForms WebView labels Aug 7, 2018
@rjmurillo rjmurillo self-assigned this Aug 7, 2018
@rjmurillo rjmurillo requested a review from nmetulev August 7, 2018 21:22
@rjmurillo rjmurillo added this to the 4.0 milestone Aug 7, 2018
@rjmurillo rjmurillo changed the title Fix deadlock on InvokeScript Fix deadlock on InvokeScript (4.0.0) Aug 7, 2018
@nmetulev nmetulev merged commit e94536d into CommunityToolkit:master Aug 7, 2018
@rjmurillo rjmurillo deleted the WebView/2367_40 branch August 7, 2018 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebView 🖥️ WPF and WinForms WebView

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows Forms Webview.InvokeScript causes deadlock on javascript errors

2 participants