Move LazyAssemblyLoader to Microsoft.JSInterop, register it in AddInt… #61703
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
LazyAssemblyLoaderinAddInteractiveWebAssemblyComponents.LazyAssemblyLoaderto Microsoft.JSInterop`.Microsoft.AspNetCore.Components.WebAssembly.Reasoning
We want to register
LazyAssemblyLoaderinAddInteractiveWebAssemblyComponentsin order to prevent the confusing situation where a component that injectsLazyAssemblyLoaderworks in the WebAssembly client but crashes during prerendering. (Note that it works when the wasm client takes over becauseWebAssemblyHostBuilder.CreateDefaultregistersLazyAssemblyLoader.)However, this could not be done as is without adding a problematic reference between projects. To avoid this, the PR moves
LazyAssemblyLoaderto theMicrosoft.JSInteropproject 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 inMicrosoft.AspNetCore.Components.WebAssemblyusing theTypeForwardedToassembly attribute.