[Blazor] Add unsupported compat switch for property injection #63493
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.
Add switch to disable property injection in default component factory
Adds an unsupported app context switch to disable property injection within the default component factory. The switch prevents injection of
@inject
properties so a custom activator can handle activation and property population.Description
Adds a new, unsupported AppContext switch that disables property injection for components activated through the default component factory. When enabled, the framework will skip injecting
@inject
properties so that a custom activator (for example, one backed by a different DI container) can perform property activation instead.This change addresses the scenario where component property activation currently always uses the app's DI container and cannot be overridden by custom activators. With the switch, custom implementations that rely on a separate container can take full control of property activation.
Customer Impact
This is not a switch for public consumption but rather a switch we are providing to support first parties in 10.0. On 11.0 we will add a public API to support this scenario and remove this switch.
Regression?
Risk
Justification: The change is gated behind an unsupported AppContext switch and is opt-in. It does not change the default behavior and only affects activation when the switch is explicitly enabled.
Verification
Packaging changes reviewed?