dotnet/aspnetcore · error · InvalidOperationException

Object of type '{targetType.FullName}' does not have a prope

Error message

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

What it means

Thrown by ComponentProperties.ThrowForUnknownIncomingParameterName when no property at all on the component matches the incoming parameter name (case-insensitive). The parameter name is simply not declared on the target component type.

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 294cab2f9b)

Solutions

  1. Check the spelling and casing of the parameter name against the component's declared parameters.
  2. If the component is from a library, verify the parameter exists in that version (check release notes/XML docs).
  3. Use IntelliSense / the component's source to confirm the exact parameter name.

Example fix

// before
<Child ForeColour="red" />

// after
<Child ForeColor="red" /> // match the actual property name
Defensive patterns

Strategy: validation

Validate before calling

// Verify a parameter name exists (case-insensitively) on a component type.
static bool ParameterExists(Type componentType, string name)
    => componentType.GetProperty(name,
        BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase) is not null;

Type guard

static bool HasPropertyNamed(Type t, string name)
    => t.GetProperty(name, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase) is not null;

Prevention

When it happens

Trigger: A typo in a parameter name in markup; passing a parameter that exists on a different component; a renamed parameter after a version change.

Common situations: Spelling mistake in an attribute name; copy-paste from another component; a library upgrade that renamed a parameter; casing differences that don't match case-insensitively.

Related errors


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