[release/8.0-preview6] [Blazor] Allow properties marked with both [Parameter]
and [SupplyParameterFromQuery]
to receive values directly
#49038
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.
Allow properties marked with both
[Parameter]
and[SupplyParameterFromQuery]
to receive values directlyFixes an issue where if a component parameter was marked with both
[Parameter]
and[SupplyParameterFromQuery]
, a misleading exception message would be thrown when the parameter's value was set directly.Backport of #48954
Description
Since #48554 was merged, marking a component parameter with both
[Parameter]
and[SupplyParameterFromQuery]
would cause the following exception to be thrown if the parameter was set directly:This is a breaking change because prior to the recent changes, component parameters annotated with both attributes could receive values directly without throwing an exception.
This PR fixes the issue by allowing
[Parameter]
and[SupplyParameterFromQuery]
to both exist on a single property without causing an exception to be thrown. If both direct and cascading parameter values are supplied, the direct parameter value is preferred.Fixes #48937
Customer Impact
Moderate. It's somewhat uncommon to need to do this, but the original issue report did mention a component library that was impacted by this change.
Regression?
Regressed from .NET 8.0 Preview 5
Risk
This is a straightforward change in a well-tested area, and new tests have been added to verify that the fix works correctly.
Verification
Packaging changes reviewed?