aspnetcore: Blazor WebAssembly lazy loading assemblies not working when using @ref attribute in the component

Describe the bug

  • When using Blazor WebAssembly lazy loading assemblies with component’s @ref attribute, the corresponding assembly could not load issue throws in the browser console and the application not running.

To Reproduce

https://github.com/ajithr/blazor-wasm-lazy-ref

  • Check out the above repo and open ~/LazyLoadingRef/LazyLoadingRef.csproj file in the VS 2019.
  • Run the application it will throw exceptions in the browser console.
  • Open ~/LazyLoadingRef/Pages/Counter.razor file and remove @ref attribute and LazyLoadComponent reference in the @code section.
  • Run the sample again and it will work properly with the lazy loading feature. image

Exceptions (if any)

image

Further technical details

  • ASP.NET Core version - .net5.0

  • Include the output of dotnet --info image

  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version image

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 12
  • Comments: 17 (11 by maintainers)

Most upvoted comments

Hi Guys, I’m facing same exceptions. May I know the status of this issue?

@ajithr Thanks for the following up. Reopening this issue and moving to backlog.

I had a hunch that this might be caused by some issues that existed in the codepaths used for assembly loading in the WASM runtime. We’ll need to (1) validate if this still happens in .NET 6 and (2) investigate why if it does.

@ajithr thanks for contacting us.

This seems to be an issue, I can’t tell there’s anything wrong from looking at the code.

@captainsafia do you have any thoughts?