Skip to content
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

Add first WinForms Async experimental APIs #11828

Closed

Conversation

KlausLoeffelmann
Copy link
Member

@KlausLoeffelmann KlausLoeffelmann commented Aug 6, 2024

Note: This PR is based on #10985.
That's why this PR has been based against feature/darkmode which holds the exact copy of the DarkMode feature.

Introduces new experimental APIs for .NET 9:

Control.InvokeAsync.
TaskDialog.ShowDialogAsync.
Form.ShowAsync.
Form.ShowDialogAsync

Fixes #10739.
Replaces #9827.

@@ -6858,6 +6858,14 @@ private bool NotifyValidating()
return ev.Cancel;
}

/// <summary>
/// Called by the NativeWindow callback, when an exception is caught. This will be rerouted to the
/// Application.ThreadException, but in certain Async scenarios it makes more sense, to be able to
Copy link
Member

Choose a reason for hiding this comment

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

What certain scenarios?

Copy link
Member Author

Choose a reason for hiding this comment

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

Showing Forms, whose Exception handling was always handled unfortunate to begin with, maybe later also Popups for .NET 10.

Example: Throw an exception in Form.OnLoad and try to gracefully handle it, when you Show (not Dialog-show) the form from another form. It's a discoverability nightmare for so many folks. My aim is it to make it more intuitively. And retrofit at least analyzers for it later.

Copy link
Member

Choose a reason for hiding this comment

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

The example needs added in remarks. Pull out everything but the summary into remarks.

/// <param name="action">The synchronous action to execute.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>A task representing the operation and containing the function's result.</returns>
[Experimental(DiagnosticIDs.ExperimentalAsync, UrlFormat = "https://aka.ms/winforms-experimental/{0}")]
Copy link
Member

Choose a reason for hiding this comment

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

I thought the plan was for these ones (InvokeAsync) to not be experimental.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll ask Immo.

I am with you, but then I would beg you to keep the option for me to REALLY test InvokeAsync additionally coming Saturday and Sunday and then, should I find something, do a follow-up PR before we snap on Sunday afternoon. Would you let me?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. Not experimental.

@KlausLoeffelmann KlausLoeffelmann force-pushed the WinFormsAsync branch 2 times, most recently from 51e9159 to 908f0bc Compare August 8, 2024 17:30
@KlausLoeffelmann KlausLoeffelmann force-pushed the WinFormsAsync branch 2 times, most recently from 484eefb to 5870b4b Compare August 9, 2024 07:38
@KlausLoeffelmann
Copy link
Member Author

KlausLoeffelmann commented Aug 9, 2024

Closing this PR, as it needs to be cherry-picked into a new one based on main.
#11854.

@merriemcgaw
Copy link
Member

Note that this is not dead, we're simply trying to detangle it from some other work to ensure it gets in for RC1 as an encapsulated change rather than dependent on other PRs in flight.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
draft draft PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Umbrella-Item] Planned "async feature" work for .NET 10
4 participants