Skip to content

Move LazyAssemblyLoader to Microsoft.JSInterop, register it in AddInt… #61703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oroztocil
Copy link
Member

Changes

  • Adds DI registration for LazyAssemblyLoader in AddInteractiveWebAssemblyComponents.
  • Moves LazyAssemblyLoader to Microsoft.JSInterop`.
  • Adds type forwarding for the moved type in Microsoft.AspNetCore.Components.WebAssembly.

Reasoning

We want to register LazyAssemblyLoader in AddInteractiveWebAssemblyComponents in order to prevent the confusing situation where a component that injects LazyAssemblyLoader works in the WebAssembly client but crashes during prerendering. (Note that it works when the wasm client takes over because WebAssemblyHostBuilder.CreateDefault registers LazyAssemblyLoader.)

However, this could not be done as is without adding a problematic reference between projects. To avoid this, the PR moves LazyAssemblyLoader to the Microsoft.JSInterop project which is the only project that is already references by all other relevant projects and already has unsafe code enabled. This means no change in project configuration is needed. To ensure backwards compatibility, the moved type needs to be type forwarded in Microsoft.AspNetCore.Components.WebAssembly using the TypeForwardedTo assembly attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant