Assembly lazy load in a Blazor WebProject with rendermode InteractiveWebAssembly(Page/component)
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
Hello,
following this example:
https://learn.microsoft.com/en-us/aspnet/core/blazor/webassembly-lazy-load-assemblies?view=aspnetcore-8.0
I was able to use the assembly lazy load in a Blazor WebAssembly application in net8, now I am trying to implement the same in a Blazor Web Application with `rendermode InteractiveWebAssembly`.
The start solution has two project, the application project and the .Client project. I added a `RCL library (LazyLibrary)` to the solution, inside the `RCL` I added a page component with `@rendermode RenderMode.InteractiveWebAssembly`. I added to .Client project a reference to `RCL` and I added
```
```
to application project file, but I can not navigate to the page in the `RCL`.
This are the key points I understood:
The classic Blazor WebAssembly project has `Router.AdditionalAssemblies `empty when it starts. The Blazor webApp seems always ignore `Router.AdditionalAssemblies` but use the new extension method `app.MapRazorComponents().AddAdditionalAssemblies(...)`, so to reproduce the same I didnt add the `LazyLibrary` to `AddAdditionalAssemblies`. In this case, when I run the applicazion and I try to navigate to the page in the `RCL`, I get a `404` and `OnNavigateAsync` not fire. So I tried to add the `LazyLibrary `to `AddAdditionalAssemblies` in` programs.cs`. In this way, when I navigate to the page in the RCL, the body of the page is rendered, `OnNavigateAsync` fire, but I get the error:

If i first navigate to counter(that download the application) and after I navigate to the page in the RCL I get this error

Maybe because the asemblies added (in `OnNavigateAsync`) to `Router.AdditionalAssemblies` is ignored.
So is it possible implement Assembly lazy load in a Blazor Web project with `rendermode InteractiveWebAssembly`?
If it is useful the simply project I am using is at :
https://github.com/GLuca74/BlazorApp2
Thanks
### Expected Behavior
Implement Assembly lazy load
### Steps To Reproduce
https://github.com/GLuca74/BlazorApp2
### Exceptions (if any)
_No response_
### .NET Version
8.0.107
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.