[release/6.0] Backport Blazor boot config fix #41992
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport Blazor boot config fix
Fixed a bug preventing Blazor from starting in some cases when used within an Angular or React application.
Backport of #41976
Description
There was an
instanceof Promisecheck inBootConfig.tsthat failed when the defaultPromisetype got overridden (as it does in libraries likezone.js). This PR fixes the issue by rearranging the logic to avoid performing this check.The filed issue used Blazor within in an Angular app, where Blazor was manually started using
Blazor.start()rather than letting the script auto-start. I've reproduced original bug and verified the fix locally.Fixes #40245
Customer Impact
In order to maximize the adoption of Blazor, we want to minimize the effort required for customers to start being productive. If a customer is already developing an application written in a JavaScript-based SPA framework, they would be hesitant to adopt Blazor if it meant re-writing their entire application. Therefore, it has been a goal of ours to ensure customers can reuse their existing code while adding new features using Blazor.
A viable approach to achieve this in .NET 5 was to load an entire Blazor app within an existing non-Blazor app. While this scenario has been improved in .NET 6 to support adding and removing individual Blazor components anywhere on the page, some customers still use the older approach.
A bug introduced in .NET 6 prevents the older approach from working if Blazor initialization is manually deferred. This fix would re-enable that scenario.
Regression?
Version the behavior has regressed from: .NET 5
Risk
The change is small, and we have ample test coverage for already-working scenarios.
Verification
Packaging changes reviewed?