dotnet/aspnetcore · error · ArgumentException
Unknown parameter '{param.Name}'
Error message
Unknown parameter '{param.Name}' What it means
SectionContent.SetParameterValues manually switches on known parameter names (SectionName, SectionId, IsDefaultContent, ChildContent) instead of using ParameterView.SetParameterProperties. The default branch throws ArgumentException for any unrecognized name. Unlike the framework's automatic parameter binder, this strict switch gives no tolerance for typos or casing differences.
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 294cab2f9b)
Solutions
- Correct the attribute name to one of: SectionName, SectionId, or ChildContent (IsDefaultContent is internal and set by the framework).
- Match casing exactly — Razor is case-sensitive for these switch keys.
- Inspect any splatted dictionary passed via @attributes and remove keys that are not valid SectionContent parameters.
- Avoid passing IsDefaultContent from markup; default content is configured via the framework's SectionOutlet default-content API, not user parameters.
Example fix
// before
<SectionContent Section="header" ChildContent="@frag">
</SectionContent>
// after
<SectionContent SectionName="header">
@frag
</SectionContent> Defensive patterns
Strategy: validation
Validate before calling
// Whitelist SectionContent attributes before splatting
var allowed = new HashSet<string>(StringComparer.Ordinal)
{
nameof(SectionContent.SectionName),
nameof(SectionContent.SectionId),
nameof(SectionContent.ChildContent)
};
foreach (var key in attributes.Keys.ToList())
if (!allowed.Contains(key)) attributes.Remove(key); Type guard
static bool IsValidSectionContentParam(string name) =>
name is nameof(SectionContent.SectionName)
or nameof(SectionContent.SectionId)
or nameof(SectionContent.ChildContent); Prevention
- Never splat unfiltered dictionaries into SectionContent.
- Use nameof() for attribute keys to avoid typos.
- Do not attempt to set IsDefaultContent from user markup — it is internal-only.
When it happens
Trigger: Passing an unknown attribute in markup, e.g. <SectionContent Section="header"> (misspelled as 'Section' instead of 'SectionName'), or splatting a dictionary whose keys include an extra entry. The strict switch fires on the first unknown parameter encountered during iteration.
Common situations: Typo in the attribute name (Section vs SectionName, Id vs SectionId); copy-paste from a SectionOutlet that uses different parameter casing; a splatted dictionary carrying stale keys; attempting to pass IsDefaultContent from user markup (it is internal-only).
Related errors
- SectionContent requires that 'SectionName' and 'SectionId' c
- SectionContent requires a non-null value either for 'Section
- SectionOutlet requires that 'SectionName' and 'SectionId' ca
- SectionOutlet requires a non-null value either for 'SectionN
- Unable to set property '{parameterName}' on object of type '
AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06).
Data as JSON: /api/errors/d2f8ebc829f066d4.
Report an issue: GitHub.