Skip to main content
All docs
V24.1

Cannot pass the parameter 'X' to component 'Y' with rendermode 'InteractiveServerRenderMode'

  • 2 minutes to read

If in a .NET 8 application, an interactive child component takes a non-serializable parameter, such as a render fragment, the following exception is raised:

Cannot pass the parameter ‘X’ to component ‘Y’ with rendermode ‘InteractiveServerRenderMode’. This is because the parameter is of the delegate type ‘Microsoft.AspNetCore.Components.RenderFragment’, which is arbitrary code and cannot be serialized.

This exception can be raised for InteractiveServerRenderMode, InteractiveWasmRenderMode, and InteractiveAutoRenderMode.

Refer to the following topic for more information: Child component with a serializable parameter.

The following tips can help you to solve this issue:

  • Enable interactive render mode for a parent component that has serializable parameters only or make the entire application interactive.

  • The DevExpress project template uses the built-in ASP.NET Core Blazor authentication. Built-in authentication pages are static according to their design. To use built-in authentication pages in an interactive component, apply a conditional render mode based on path parameters.

    <head>
        @* ... *@
        <HeadOutlet @rendermode="RenderModeForPage" />
    </head>
    <body>
        <Routes @rendermode="RenderModeForPage"></Routes>
        @* ... *@
    </body>
    
    @code{
        [CascadingParameter]
        private HttpContext HttpContext { get; set; } = default!;
    
        private IComponentRenderMode? RenderModeForPage => HttpContext.Request.Path.StartsWithSegments("/Account")
            ? null
            : InteractiveAuto;
    }
    
  • To use our components in static mode, you may need to write additional code. See component descriptions for more details.