dotnet/aspnetcore · error · NotSupportedException
Cannot supply a component of type '{componentType}' because
Error message
Cannot supply a component of type '{componentType}' because the current platform does not support the render mode '{renderMode}'. What it means
ResolveComponentForRenderMode is a virtual method on Renderer whose base implementation throws NotSupportedException. Renderer subclasses (such as those in the Server and WebAssembly hosts) override it to support specific render modes. When a component declares or is assigned a render mode (via @rendermode or [RenderMode]) that the current platform's renderer does not support, the base method throws. This is the mechanism that prevents, for example, trying to render a WebAssembly component in a pure static SSR context.
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 294cab2f9b)
Solutions
- Ensure the render mode you apply (@rendermode) matches a platform that is configured. In Program.cs, call builder.Services.AddRazorComponents().AddInteractiveServerComponents() and/or AddInteractiveWebAssemblyComponents().
- Verify that the .Client project exists and is referenced if using InteractiveWebAssembly or InteractiveAuto.
- If using per-page interactivity, make sure each page's @rendermode matches an enabled platform.
- If you need static SSR only, remove all @rendermode directives from the component or page.
- Update to a compatible Blazor version if a render mode type is not recognized.
Example fix
// before (Program.cs - missing WebAssembly services)
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
// but razor has: @rendermode InteractiveWebAssembly
// after
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
builder.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents(renderMode => { }); // ensure client project referenced Defensive patterns
Strategy: validation
Validate before calling
// Check configured render modes before applying @rendermode
static bool IsRenderModeSupported(IServiceCollection services, IComponentRenderMode mode)
{
// Check that the corresponding Add*Components() was called
// This is a heuristic; actual support is determined by the renderer
return mode is InteractiveServerRenderMode
|| mode is InteractiveWebAssemblyRenderMode
|| mode is InteractiveAutoRenderMode;
}
// Ensure in Program.cs:
// builder.Services.AddRazorComponents()
// .AddInteractiveServerComponents()
// .AddInteractiveWebAssemblyComponents(); Type guard
null // No type guard; render mode support is runtime/config-dependent
Try / catch
try
{
// Render component with render mode
}
catch (NotSupportedException ex) when (ex.Message.Contains("render mode"))
{
// Fallback to static SSR or log configuration error
logger.LogError(ex, "Render mode not supported. Check Program.cs services.");
} Prevention
- Register all required render mode services in Program.cs (AddInteractiveServerComponents, AddInteractiveWebAssemblyComponents).
- Ensure the .Client project is referenced when using WebAssembly or Auto render modes.
- Write an integration test that verifies each render mode works end-to-end.
- Document which render modes are enabled in the app's configuration.
When it happens
Trigger: Applying a render mode (InteractiveServer, InteractiveWebAssembly, InteractiveAuto) to a component when the active renderer does not support it. For example, using InteractiveWebAssembly in a project that doesn't have WebAssembly services configured, or using InteractiveServer in a static SSR-only Blazor Web App. Also triggered if the renderer subclass's override logic doesn't handle the specific render mode value.
Common situations: Adding @rendermode InteractiveWebAssembly without configuring WebAssembly interactivity in Program.cs; using InteractiveServer in a component rendered during static SSR; version mismatch where a render mode constant exists but the host services aren't registered; misconfigured Blazor Web App that mixes global vs per-page interactivity incorrectly.
Related errors
- Interop methods are already registered for renderer ${render
- Interop methods are not registered for renderer ${rendererId
- No interop methods are registered for renderer ${rendererId}
- Unexpected renderer ID '${rendererId}' encountered while dis
- There are multiple .NET runtimes present, so a default dispa
AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06).
Data as JSON: /api/errors/29a03295b5c80fc5.
Report an issue: GitHub.