-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- 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
<ItemGroup>
<BlazorWebAssemblyLazyLoad Include="LazyLibrary.wasm" />
</ItemGroup>
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<App>().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

