Skip to content

Clarify async scenarios and deadlocks #2112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

adegeo
Copy link
Contributor

@adegeo adegeo commented Aug 18, 2025

Summary

A long time coming. Updates a few places with information about deadlocks and demonstrates code. Also adds reference to the new InvokeAsync methods in .NET 9.

Fixes #1406


Internal previews

📄 File 🔗 Preview link
dotnet-desktop-guide/winforms/controls/how-to-make-thread-safe-calls.md dotnet-desktop-guide/winforms/controls/how-to-make-thread-safe-calls
dotnet-desktop-guide/winforms/forms/events.md dotnet-desktop-guide/winforms/forms/events

Copy link
Member

@KlausLoeffelmann KlausLoeffelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's talk about a few aspects here.
We should also address .ConfigureAwait(true/false), and point out, how it can help in simplifying certain type of marshalling work, but can also impose deadlocks when applied poorly.

For the ValueTask issue in VB, I think I have a workaround, which we should provide in the docs.

adegeo and others added 9 commits August 19, 2025 11:21
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>
Co-authored-by: Klaus Löffelmann <9663150+KlausLoeffelmann@users.noreply.github.com>
@adegeo
Copy link
Contributor Author

adegeo commented Aug 21, 2025

@KlausLoeffelmann I addressed your feedback.

  • I also renamed snippets and code files to be clearer.
  • I removed code that was unused.
  • I also rewrote some of the snippets to better demonstrate the concepts being talked about here.
  • One other thing I did was reorder the bullet points to emphasize InvokeAsync, then Invoke, then BackgroundWorker.

@BillWagner BillWagner self-requested a review August 21, 2025 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Async event handlers
2 participants