Skip to content

.Net 9 Blazor Server doesn't find components in interactive mode #58625

@Julien-Marpault

Description

@Julien-Marpault

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a solution with a hierarchy of projects:

Store
|_ Presentation
|_ Application
|_Domain
etc.

My App.razor and Routes.razor are in the Store project. My other pages are in the presentation project.

I added AdditionalAssemblies:

app.MapRazorComponents<App>()
    .AddInteractiveServerRenderMode()
    .AddAdditionalAssemblies(typeof(Presentation.Pages.Index).Assembly);

If I try to use InteractiveServer on Routes component I get a Not found error, the app can't find the '/' route. The same issue occurs when using this mode on HeadOutlet component.

If I don't use InteractiveServer render mode it works fine.

So I tried to apply InteractiveServer to my Layout because I have some interactivity in my layout.
I get this error:

InvalidOperationException: Cannot pass the parameter 'Body' to component 'MainLayout' 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.

Last try, I moved my pages to Store project leaving other components to Presentation.
It works fine, but it's an issue to not be able to put my pages in a separate library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Attention 👋This issue needs the attention of a contributor, typically because the OP has provided an update.area-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions