dotnet/aspnetcore · error · InvalidOperationException

Object of type ' ' does not have a property matching the…

Error message

Object of type '{targetType.FullName}' does not have a property matching the name '{parameterName}'.

What it means

The else-branch of ThrowForUnknownIncomingParameterName: the incoming parameter name does not match any property on the component type at all (not even an un-annotated one). The framework received a parameter value it cannot deliver because no property with that name exists. This typically indicates a typo, a stale binding after a property was removed/renamed, or parameters being passed to the wrong component.

Solutions

  1. Check the spelling and casing of the parameter name against the component's declared parameters.
  2. If the property was renamed, update all consumers to the new name.
  3. To accept arbitrary unmatched attributes, add a property with [Parameter(CaptureUnmatchedValues = true)] of type Dictionary<string, object>.

Example fix

// before
<Counter Count="5" Dsiplay="true" /> // 'Dsiplay' does not exist

// after
<Counter Count="5" Display="true" />
Defensive patterns

Strategy: validation

Validate before calling

// Verify the parameter name exists on the component before rendering.
var prop = typeof(MyComponent).GetProperty("Foo",
    BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
if (prop == null)
    throw new ArgumentException("Unknown parameter 'Foo'");

Prevention

When it happens

Trigger: Specifying a parameter in markup (e.g., <MyComponent Foo="1" />) where MyComponent has no Foo property. Passing unmatched attributes when the component does not declare a [Parameter(CaptureUnmatchedValues = true)] sink. Renaming a component property and forgetting to update consumers.

Common situations: Typos in attribute names in .razor files. Copy-pasting markup between components with different parameter sets. Stale generated code after refactoring. Passing parameters intended for a different component type.

Related errors


AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11). Data as JSON: /api/errors/100045c209f378c5. Report an issue: GitHub.

Appendix: source

Thrown at src/Components/Components/src/Reflection/ComponentProperties.cs:215

        if (propertyInfo != null)
        {
            if (!propertyInfo.IsDefined(typeof(ParameterAttribute)) &&
                !propertyInfo.GetCustomAttributes().OfType<CascadingParameterAttributeBase>().Any())
            {
                throw new InvalidOperationException(
                    $"Object of type '{targetType.FullName}' has a property matching the name '{parameterName}', " +
                    $"but it does not have [Parameter], [CascadingParameter], or any other parameter-supplying attribute.");
            }
            else
            {
                // This should not happen
                throw new InvalidOperationException(
                    $"No writer was cached for the property '{propertyInfo.Name}' on type '{targetType.FullName}'.");
            }
        }
        else
        {
            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 " +

View on GitHub (pinned to 3600ca084e)