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

[release/9.0.1xx] [Blazor Hybrid] Fire and forget BlazorWebView disposal by default #25430

Merged

Conversation

MackinnonBuck
Copy link
Member

Changes the default behavior of BlazorWebViewHandler to fire-and-forget the disposal of the underlying WebViewManager by default.

Fixes #24407
Fixes #24250

@MackinnonBuck MackinnonBuck requested a review from a team as a code owner October 21, 2024 22:09
@MackinnonBuck MackinnonBuck requested a review from Eilon October 21, 2024 22:09
Comment on lines +79 to +81
var shouldBlockOnDispose = AppContext.TryGetSwitch(AndroidFireAndForgetAsyncSwitch, out var enableFireAndForget)
? !enableFireAndForget
: IsBlockingDisposalEnabled;
Copy link
Member Author

Choose a reason for hiding this comment

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

This logic ensures that if the "BlazorWebView.AndroidFireAndForgetAsync" switch was specified previously, we will continue to use that value, regardless of whether the new AppContext switch is also specified.

else
{
// Otherwise, by default, we'll fire-and-forget the disposal task.
disposalTask.FireAndForget();
Copy link
Member Author

Choose a reason for hiding this comment

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

Unlike with the other BlazorWebViewHandler implementations, there wasn't already an ILogger available to pass to the FireAndForget call here. If others think it's worth it or necessary to obtain one from the service provider, I won't object to adding it.

Copy link
Member

Choose a reason for hiding this comment

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

I think this code is fine.

@PureWeen PureWeen merged commit e2e6f6c into release/9.0.1xx Oct 22, 2024
7 checks passed
@PureWeen PureWeen deleted the mbuck/fire-and-forget-blazorwebview-disposal branch October 22, 2024 03:45
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2024
@samhouts samhouts added fixed-in-9.0.0 fixed-in-net8.0-nightly This may be available in a nightly release! labels Dec 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-9.0.0 fixed-in-net8.0-nightly This may be available in a nightly release!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants