Skip to content

Conversation

@MackinnonBuck
Copy link
Member

@MackinnonBuck MackinnonBuck commented Jun 1, 2022

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 Promise check in BootConfig.ts that failed when the default Promise type got overridden (as it does in libraries like zone.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?

  • Yes
  • No

Version the behavior has regressed from: .NET 5

Risk

  • High
  • Medium
  • Low

The change is small, and we have ample test coverage for already-working scenarios.

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

@MackinnonBuck MackinnonBuck added Servicing-consider Shiproom approval is required for the issue area-blazor Includes: Blazor, Razor Components labels Jun 1, 2022
@MackinnonBuck MackinnonBuck requested a review from a team as a code owner June 1, 2022 22:16
@ghost ghost added this to the 6.0.x milestone Jun 1, 2022
@ghost
Copy link

ghost commented Jun 1, 2022

Hi @MackinnonBuck. If this is not a tell-mode PR, please make sure to follow the instructions laid out in the servicing process document.
Otherwise, please add tell-mode label.

@ghost
Copy link

ghost commented Jun 1, 2022

Hi @MackinnonBuck. Please make sure you've updated the PR description to use the Shiproom Template. Also, make sure this PR is not marked as a draft and is ready-to-merge.

To learn more about how to prepare a servicing PR click here.

Copy link
Contributor

@TanayParikh TanayParikh left a comment

Choose a reason for hiding this comment

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

Approving backport

@mkArtakMSFT mkArtakMSFT added Servicing-approved Shiproom has approved the issue and removed Servicing-consider Shiproom approval is required for the issue labels Jun 2, 2022
@mkArtakMSFT
Copy link
Contributor

This was approved by Tactics. @MackinnonBuck please coordinate with @wtgodbe and @dougbu regarding when to merge this PR.

@dougbu
Copy link
Contributor

dougbu commented Jun 7, 2022

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@wtgodbe wtgodbe merged commit e51948e into release/6.0 Jun 9, 2022
@wtgodbe wtgodbe deleted the mbuck/backport-fix-blazor-boot-config branch June 9, 2022 20:55
@dougbu dougbu modified the milestones: 6.0.x, 6.0.7 Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants