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

Fix BlazorWebView on iOS/MacCatalyst 18 #23906

Merged
merged 4 commits into from
Jul 30, 2024
Merged

Conversation

Eilon
Copy link
Member

@Eilon Eilon commented Jul 30, 2024

Description of Change

Starting wtih iOS/MacCatalyst 18 the internal 0.0.0.0 address used to host the BlazorWebView's content no longer works and causes the BlazorWebView to not load and render as an empty rectangle. It turns out that using localhost as the base address does work (credit to @veler for discovering and sharing this!). This change changes the default behavior to be localhost on iOS/MacCatalyst 18 and newer. No other platforms are changed at all.

I've added a back-compat switch to always use 0.0.0.0 in case the new behavior causes any problem, which can be activated using this switch at the start of MauiProgram.cs in an app:

// Set this switch to use the LEGACY behavior of always using 0.0.0.0 to host BlazorWebView
AppContext.SetSwitch("BlazorWebView.AppHostAddressAlways0000", true);

I've started testing this and it looks good, but I have some more testing to do.

Issues Fixed

Fixes #23390

@Eilon Eilon added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Jul 30, 2024
@Eilon Eilon requested a review from a team as a code owner July 30, 2024 05:10
@rmarinho rmarinho merged commit 9821d18 into main Jul 30, 2024
94 of 97 checks passed
@rmarinho rmarinho deleted the eilon/net8-0000-address branch July 30, 2024 10:33
@samhouts samhouts added the fixed-in-net9.0-nightly This may be available in a nightly release! label Aug 2, 2024
@samhouts samhouts added fixed-in-8.0.80 fixed-in-net9.0-nightly This may be available in a nightly release! and removed fixed-in-net9.0-nightly This may be available in a nightly release! labels Aug 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView fixed-in-8.0.80 fixed-in-net9.0-nightly This may be available in a nightly release!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blazor Hybrid not working on MacOS 15.0 [Potential fix]
4 participants