dotnet/aspnetcore · error · ArgumentException

Missing required parameter

Error message

Missing required parameter '{nameof(Value)}' for component '{GetType().Name}'.

What it means

CascadingValue requires a Value parameter to be supplied. A null Value is acceptable for reference-type TValue, but the parameter entry itself must be present because a CascadingValue with no value serves no purpose and would silently break consumers.

Solutions

  1. Add the Value attribute to the <CascadingValue> element.
  2. If null is intentional for a reference type, explicitly set Value="@(null)".
  3. Add an @if guard so the CascadingValue only renders when a value is available.

Example fix

// before
<CascadingValue Name="myCtx">
    <Child />
</CascadingValue>
// after
<CascadingValue Name="myCtx" Value="@myValue">
    <Child />
</CascadingValue>
Defensive patterns

Strategy: validation

Validate before calling

// Guard the markup so CascadingValue only renders when a value exists.
@if (myValue is not null || typeof(TValue).IsValueType)
{
    <CascadingValue Value="@myValue">@ChildContent</CascadingValue>
}

Prevention

When it happens

Trigger: <CascadingValue Name="ctx"> without a Value attribute, or a ParameterView that omits the 'Value' entry entirely.

Common situations: Forgot the Value attribute, conditional rendering that strips Value under some branch, or binding Value to an expression that produces no parameter.

Related errors


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

Appendix: source

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

            }
            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.
        // Given a components A (parent) -> B (child), you want them to be queued in order
        // [A, B] because if you had [B, A], then the render for A might change B's params
        // making it render again, so you'd render [B, A, B], which is wasteful.
        // At some point we might consider making the render queue actually enforce this
        // ordering during insertion.
        //
        // For the CascadingValue component, this observation is why it's important to render
        // ourself before notifying subscribers (which can be grandchildren or deeper).
        // If we rerendered subscribers first, then our own subsequent render might cause an
        // further update that makes those nested subscribers get rendered twice.
        _renderHandle.Render(Render);

        if (_subscribers != null && ChangeDetection.MayHaveChanged(previousValue, Value))
        {
            NotifySubscribers(parameters.Lifetime);

View on GitHub (pinned to 3600ca084e)