dotnet/aspnetcore · error · NotSupportedException
Cannot supply a component of type
Error message
Cannot supply a component of type '{componentType}' because the current platform does not support the render mode '{renderMode}'. What it means
ResolveComponentForRenderMode was asked to instantiate a component whose declared IComponentRenderMode is not supported by the current Renderer subclass. The base Renderer throws NotSupportedException by default; subclasses (HtmlRenderer, WebAssemblyRenderer, etc.) override it to opt into specific modes. So the throw means no renderer in the host platform accepted the requested mode.
Solutions
- Register the matching interactivity services in Program.cs: AddInteractiveServerComponents() and/or AddInteractiveWebAssemblyComponents().
- Confirm the component's @rendermode matches a mode the host actually supports (Server vs WebAssembly vs None).
- For tests, subclass HtmlRenderer and override ResolveComponentForRenderMode to support the modes under test.
- Check that the project references the right interactivity package (e.g. Microsoft.AspNetCore.Components.Server).
Example fix
// before
builder.Services.AddRazorComponents();
// after
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents(); Defensive patterns
Strategy: validation
Validate before calling
// At startup, verify the host supports the modes your components declare
var supported = builder.Services.Where(d => d.ServiceType == typeof(IComponentRenderMode)).ToList();
// and ensure AddInteractive{Server,WebAssembly}Components() are called for the modes used Prevention
- Register AddInteractiveServerComponents()/AddInteractiveWebAssemblyComponents() in Program.cs.
- Keep a project convention: components declare @rendermode only when the host supports it.
- For tests, override ResolveComponentForRenderMode on a custom HtmlRenderer subclass.
When it happens
Trigger: A component declares @rendermode or a caller specifies RenderMode.ServerInteractivePrerendered but the running host is a static/server-only renderer (HtmlServerPrerendered with no interactivity, or a unit-test HtmlRenderer). Prerendering on a host that doesn't have Server/WebAssembly interactivity configured. Mixing render modes unsupported by the project's interactivity config in .NET 8+.
Common situations: Adding @rendermode InteractiveServer to a component in a project where `builder.Services.AddRazorComponents().AddInteractiveServerComponents()` was never called. Running a Blazor Web App under a host that only does static SSR. Migrating a Server-only app and forgetting to register interactivity. Unit tests using a plain HtmlRenderer that doesn't override ResolveComponentForRenderMode.
Related errors
- Cannot merge mismatching component descriptors
- Cannot provide a value for property
- Cannot provide a value for property
- Cannot provide a value for property
- componentActivator
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/29a03295b5c80fc5.
Report an issue: GitHub.
Appendix: source
Thrown at src/Components/Components/src/RenderTree/Renderer.cs:1374
/// Determines how to handle an <see cref="IComponentRenderMode"/> when obtaining a component instance.
/// This is only called when a render mode is specified either at the call site or on the component type.
///
/// Subclasses may override this method to return a component of a different type, or throw, depending on whether the renderer
/// supports the render mode and how it implements that support.
/// </summary>
/// <param name="componentType">The type of component that was requested.</param>
/// <param name="parentComponentId">The parent component ID, or null if it is a root component.</param>
/// <param name="componentActivator">An <see cref="IComponentActivator"/> that should be used when instantiating component objects.</param>
/// <param name="renderMode">The <see cref="IComponentRenderMode"/> declared on <paramref name="componentType"/> or at the call site (for example, by the parent component).</param>
/// <returns>An <see cref="IComponent"/> instance.</returns>
protected internal virtual IComponent ResolveComponentForRenderMode(
[DynamicallyAccessedMembers(Component)] Type componentType,
int? parentComponentId,
IComponentActivator componentActivator,
IComponentRenderMode renderMode)
{
// Nothing is supported by default. Subclasses must override this to opt into supporting specific render modes.
throw new NotSupportedException($"Cannot supply a component of type '{componentType}' because the current platform does not support the render mode '{renderMode}'.");
}
/// <summary>
/// Releases all resources currently used by this <see cref="Renderer"/> instance.
/// </summary>
public void Dispose()
{
Dispose(disposing: true);
}
/// <inheritdoc />
public async ValueTask DisposeAsync()
{
lock (_lockObject)
{
if (_rendererIsDisposed)
{
return;View on GitHub (pinned to 3600ca084e)