dotnet/aspnetcore · error · ArgumentException

The component ' ' does not accept a parameter with the name…

Error message

The component '{nameof(CascadingValue<TValue>)}' does not accept a parameter with the name '{parameter.Name}'.

What it means

CascadingValue<TValue> only accepts three parameters: 'Name' (string), 'IsFixed' (bool), and 'Value' (TValue). Blazor's parameter dispatcher rejects any other attribute name to surface typos and copy-paste mistakes early. This is an ArgumentException thrown during SetParametersAsync.

Solutions

  1. Check every attribute on the <CascadingValue> tag against the three valid names: Name, IsFixed, Value.
  2. Remove the offending attribute or rename it to the correct one.
  3. If you need extra behavior, wrap CascadingValue in a custom component rather than adding parameters to it.

Example fix

// before
<CascadingValue Vaule="@myVal" Name="myCtx">
// after
<CascadingValue Value="@myVal" Name="myCtx">
Defensive patterns

Strategy: validation

Validate before calling

// Validate parameter names against the allowed set before constructing CascadingValue.
var allowed = new[] { "Name", "IsFixed", "Value" };
foreach (var p in parameters)
{
    if (!allowed.Any(a => a.Equals(p.Name, StringComparison.OrdinalIgnoreCase)))
        throw new InvalidOperationException($"Unknown CascadingValue parameter '{p.Name}'.");
}

Prevention

When it happens

Trigger: Writing <CascadingValue SomeUnknown="x"> in Razor, or constructing a ParameterView programmatically with an entry whose Name is not 'Name', 'IsFixed', or 'Value' (case-insensitive match for Name/IsFixed).

Common situations: Typo in the Value attribute (e.g. 'Vaule'), copy-pasting attributes from a different component, or referencing a parameter that existed in an older version of the component.

Related errors


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

Appendix: source

Thrown at src/Components/Components/src/CascadingValue.cs:90

            else if (parameter.Name.Equals(nameof(ChildContent), StringComparison.OrdinalIgnoreCase))
            {
                ChildContent = (RenderFragment)parameter.Value;
            }
            else if (parameter.Name.Equals(nameof(Name), StringComparison.OrdinalIgnoreCase))
            {
                Name = (string)parameter.Value;
                if (string.IsNullOrEmpty(Name))
                {
                    throw new ArgumentException($"The parameter '{nameof(Name)}' for component '{nameof(CascadingValue<TValue>)}' does not allow null or empty values.");
                }
            }
            else if (parameter.Name.Equals(nameof(IsFixed), StringComparison.OrdinalIgnoreCase))
            {
                IsFixed = (bool)parameter.Value;
            }
            else
            {
                throw new ArgumentException($"The component '{nameof(CascadingValue<TValue>)}' does not accept a parameter with the name '{parameter.Name}'.");
            }
        }

        if (_hasSetParametersPreviously && IsFixed != previousFixed)
        {
            throw new InvalidOperationException($"The value of {nameof(IsFixed)} cannot be changed dynamically.");
        }

        _hasSetParametersPreviously = true;

        // It's OK for the value to be null, but some "Value" param must be supplied
        // because it serves no useful purpose to have a <CascadingValue> otherwise.
        if (!hasSuppliedValue)
        {
            throw new ArgumentException($"Missing required parameter '{nameof(Value)}' for component '{GetType().Name}'.");
        }

        // Rendering is most efficient when things are queued from rootmost to leafmost.

View on GitHub (pinned to 3600ca084e)