dotnet/aspnetcore · error · InvalidOperationException
The property ' ' on component type ' ' cannot be set using…
Error message
The property '{parameterName}' on component type '{targetType.FullName}' cannot be set using a cascading value. What it means
ThrowForSettingParameterWithCascadingValue is the inverse of 291: the framework attempted to deliver a cascading value to a property annotated with [Parameter] (ParameterAttribute) that does not accept cascading parameters (no CascadingParameterAttributeBase). Regular [Parameter] properties only receive explicitly-supplied values; routing a cascade into them is a type-of-binding mismatch.
Solutions
- If the property should receive a cascading value, replace [Parameter] with [CascadingParameter] (and a matching Name if needed).
- If the property should remain a direct parameter, supply the value explicitly rather than via CascadingValue.
- Audit the property's attributes: a property should not be marked [Parameter] if it is meant to consume cascading values.
Example fix
// before
// Theme intended as cascading, but marked [Parameter]
[Parameter] public string? Theme { get; set; }
// after
[CascadingParameter] public string? Theme { get; set; } Defensive patterns
Strategy: validation
Validate before calling
// Ensure a property meant to consume cascading values is annotated accordingly.
var prop = typeof(MyComponent).GetProperty("Theme");
bool acceptsCascade = prop?.GetCustomAttributes()
.OfType<CascadingParameterAttributeBase>().Any() == true;
if (!acceptsCascade)
throw new InvalidOperationException("Theme cannot accept a cascading value; mark [CascadingParameter]."); Prevention
- Use [CascadingParameter] for properties that consume cascading values.
- Reserve [Parameter] for explicitly-supplied values.
- Review attribute usage whenever changing a property's data source.
When it happens
Trigger: Internally, when the cascading-value dispatch tries to write to a [Parameter]-only property. A custom renderer or test harness that pushes a cascading value at a property marked [Parameter]. Misconfiguration where a property intended to be cascading is annotated only with [Parameter].
Common situations: Annotating a property with [Parameter] when it should have been [CascadingParameter], then expecting a CascadingValue to populate it. Test infrastructure that drives cascading values into normal parameters. Component libraries where the attribute was applied incorrectly.
Related errors
- The property ' ' on component type ' ' cannot be set…
- Object of type ' ' does not have a property matching the…
- The property ' ' on component type ' ' cannot be set…
- The type ' ' declares a parameter matching the name ' '…
- Unable to set property
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/7b85d9b0b79307e0.
Report an issue: GitHub.
Appendix: source
Thrown at src/Components/Components/src/Reflection/ComponentProperties.cs:232
{
throw new InvalidOperationException(
$"Object of type '{targetType.FullName}' does not have a property " +
$"matching the name '{parameterName}'.");
}
}
[DoesNotReturn]
private static void ThrowForSettingCascadingParameterWithNonCascadingValue(Type targetType, string parameterName)
{
throw new InvalidOperationException(
$"The property '{parameterName}' on component type '{targetType.FullName}' cannot be set " +
$"explicitly because it only accepts cascading values.");
}
[DoesNotReturn]
private static void ThrowForSettingParameterWithCascadingValue(Type targetType, string parameterName)
{
throw new InvalidOperationException(
$"The property '{parameterName}' on component type '{targetType.FullName}' cannot be set " +
$"using a cascading value.");
}
[DoesNotReturn]
private static void ThrowForCaptureUnmatchedValuesConflict(Type targetType, string parameterName, Dictionary<string, object> unmatched)
{
throw new InvalidOperationException(
$"The property '{parameterName}' on component type '{targetType.FullName}' cannot be set explicitly " +
$"when also used to capture unmatched values. Unmatched values:" + Environment.NewLine +
string.Join(Environment.NewLine, unmatched.Keys));
}
[DoesNotReturn]
private static void ThrowForMultipleCaptureUnmatchedValuesParameters([DynamicallyAccessedMembers(Component)] Type targetType)
{
var propertyNames = new List<string>();
foreach (var property in targetType.GetProperties(BindablePropertyFlags))View on GitHub (pinned to 3600ca084e)