dotnet/aspnetcore · error · InvalidOperationException
The {nameof(Router)} component requires a value for the para
Error message
The {nameof(Router)} component requires a value for the parameter {nameof(Found)}. What it means
Router requires a Found render fragment so that successful route matches always render through user-defined markup (this also documents the customization point for things like authorization). If Found is null at parameter-set time the Router throws InvalidOperationException, because there is no reasonable default that would also be discoverable. The check fires after the AppAssembly check.
Source
Thrown at src/Components/Components/src/Routing/Router.cs:135
}
}
/// <inheritdoc />
public async Task SetParametersAsync(ParameterView parameters)
{
parameters.SetParameterProperties(this);
if (AppAssembly == null)
{
throw new InvalidOperationException($"The {nameof(Router)} component requires a value for the parameter {nameof(AppAssembly)}.");
}
// Found content is mandatory, because even though we could use something like <RouteView ...> as a
// reasonable default, if it's not declared explicitly in the template then people will have no way
// to discover how to customize this (e.g., to add authorization).
if (Found == null)
{
throw new InvalidOperationException($"The {nameof(Router)} component requires a value for the parameter {nameof(Found)}.");
}
if (NotFoundPage != null)
{
#pragma warning disable CS0618 // Type or member is obsolete
if (NotFound != null)
{
throw new InvalidOperationException($"Setting {nameof(NotFound)} and {nameof(NotFoundPage)} properties simultaneously is not supported. Use either {nameof(NotFound)} or {nameof(NotFoundPage)}.");
}
#pragma warning restore CS0618 // Type or member is obsolete
if (!typeof(IComponent).IsAssignableFrom(NotFoundPage))
{
throw new InvalidOperationException($"The type {NotFoundPage.FullName} " +
$"does not implement {typeof(IComponent).FullName}.");
}
var routeAttributes = NotFoundPage.GetCustomAttributes(typeof(RouteAttribute), inherit: true);
if (routeAttributes.Length == 0)View on GitHub (pinned to 3600ca084e)
Solutions
- Add a <Found Context="routeData"> ... </Found> child to the Router that renders a <RouteView RouteData="@routeData" />.
- Confirm the Found attribute (if used via code-behind) is assigned a non-null RenderFragment<RouteData>.
- Use the standard Blazor template shape as the starting point.
- If you want custom not-found behavior, set NotFoundPage or NotFound separately, but Found is still mandatory.
Example fix
// before
<Router AppAssembly="@typeof(Program).Assembly">
<NotFound><p>Not found</p></NotFound>
</Router> <!-- missing Found -->
// after
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound><p>Not found</p></NotFound>
</Router> Defensive patterns
Strategy: validation
Validate before calling
// Ensure the Found template is set; in markup this is structural. Programmatic check:
if (router.Found is null)
throw new InvalidOperationException("Router.Found render fragment is required."); Prevention
- Always include <Found Context="routeData"> ... </Found> inside <Router>.
- Render <RouteView RouteData="@routeData" /> inside Found.
- Use the Blazor project template's App.razor as a starting point.
- Add a smoke test that the app renders its home route.
When it happens
Trigger: Declaring <Router> without a <Found> child template. Also by manually setting Router parameters and omitting Found, or binding Found to a fragment that is null.
Common situations: Trimming App.razor down during scaffolding and dropping the <Found> block; refactoring render fragments into code-behind and leaving the property null; copy-pasting a Router from a sample that used a different child structure.
Related errors
- The {nameof(Router)} component requires a value for the para
- Setting {nameof(NotFound)} and {nameof(NotFoundPage)} proper
- The type {NotFoundPage.FullName} does not implement {typeof(
- The type {NotFoundPage.FullName} does not have a {typeof(Rou
- The type {context.Handler.FullName} does not implement {type
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/5bea4b2290f771ec.
Report an issue: GitHub.