dotnet/aspnetcore · error · ArgumentException

Unknown parameter

Error message

Unknown parameter '{param.Name}'

What it means

SectionContent uses a hand-written SetParameterValues loop that switches on parameter name and throws ArgumentException for any unrecognized name. This is because SectionContent has an internal parameter (IsDefaultContent) it cannot expose through the auto-generated SetParameterProperties path, so unknown parameter names surface explicitly rather than being silently ignored. The throw identifies the offending parameter name.

Solutions

  1. Check the exception for the unknown parameter name and fix the markup to match a real SectionContent parameter (SectionName, SectionId, IsDefaultContent, ChildContent).
  2. After upgrading Blazor, audit SectionContent usages for parameters that may have been renamed.
  3. If building parameter dictionaries programmatically, filter to the known parameter set.

Example fix

// before
<SectionContent SectionNamed="alerts">...</SectionContent>  // typo 'SectionNamed'
// after
<SectionContent SectionName="alerts">...</SectionContent>
Defensive patterns

Strategy: type-guard

Validate before calling

// Whitelist known parameter names before calling SetParametersAsync on SectionContent.
static readonly HashSet<string> Known = new() { "SectionName", "SectionId", "IsDefaultContent", "ChildContent" };
var filtered = parameters.ToDictionary().Where(kv => Known.Contains(kv.Key)).ToArray();

Type guard

static bool IsKnownSectionContentParameter(string name)
    => name is "SectionName" or "SectionId" or "IsDefaultContent" or "ChildContent";

Prevention

When it happens

Trigger: Passing a parameter to <SectionContent> whose name is not one of: SectionName, SectionId, IsDefaultContent, ChildContent. Causes include typos, renamed parameters after a version upgrade, or tools that emit arbitrary attributes.

Common situations: Typos in markup (e.g. SectionNamed instead of SectionName); upgrading Blazor across a rename of an internal parameter; using a section component that has a different parameter surface than expected; reflected/programmatic SetParametersAsync calls that pass a stale parameter dictionary.

Related errors


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

Appendix: source

Thrown at src/Components/Components/src/Sections/SectionContent.cs:107

    {
        foreach (var param in parameters)
        {
            switch (param.Name)
            {
                case nameof(SectionContent.SectionName):
                    SectionName = (string)param.Value;
                    break;
                case nameof(SectionContent.SectionId):
                    SectionId = param.Value;
                    break;
                case nameof(SectionContent.IsDefaultContent):
                    IsDefaultContent = (bool)param.Value;
                    break;
                case nameof(SectionContent.ChildContent):
                    ChildContent = (RenderFragment)param.Value;
                    break;
                default:
                    throw new ArgumentException($"Unknown parameter '{param.Name}'");
            }
        }
    }

    /// <inheritdoc/>
    public void Dispose()
    {
        if (_registeredIdentifier is not null)
        {
            _registry.RemoveProvider(_registeredIdentifier, this);
        }
    }
}

View on GitHub (pinned to 3600ca084e)