Skip to content
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

[release/6.0.1xx][blazorwasm] Fix publishing project with lazy loaded assembly #22145

Merged
merged 4 commits into from
Oct 19, 2021

Conversation

radical
Copy link
Member

@radical radical commented Oct 18, 2021

Fixes a user reported issue - dotnet/runtime#60479

Customer Impact

This fixes publish for blazorwasm projects that use lazy loaded assemblies, when the wasm-tools workload is installed.

Testing

Some manual testing, manually running blazor/sdk tests with the workload, and a new unit test.

Regression

Yes.

Risk

Low.

A blazorwasm project referencing a razorclasslib project, which
is to be lazy loaded, fails to publish with:

`error BLAZORSDK1001: Unable to find '[lazy load assembly name].dll' to be lazy loaded later. Confirm that project or package references are included and the reference is used in the project.`

- This only happens when the `wasm-tools` workload is installed,
  irrespective of AOT.
  - That is because when the workload is installed, `publish+Release`
    defaults to relinking the runtime

- The failure happens during a nested publish.

1. For the nested publish, we essentially run `Publish` target, and then the wasm native targets run
2. during the `Publish` part of it:
    a. we get to `ProcessPublishFilesForBlazor`, which currently we skip
       for the nested publish case (`$(WasmBuildingForNestedPublish)`)
         - and this target populates `@(StaticWebAsset)`, when run

    b. Then we get to `GeneratePublishBlazorBootJson`, which fails
       because it doesn't have the `StaticWebAssets` correctly populated,
       and thus can't find the lazy loaded assembly

This commit fixes it by:

1. Making the nested publish run after *ComputeFilesToPublish* instead
   of a full `Publish`[1]
2. Disable certain targets related to static web assets, and
   compression, since those are not really needed for the nested
   publish.

.. which essentially means that we run a reduced set of targets as part
of the "nested publish", and don't trigger some unncessary ones.

In future, this will be cleaned up.

Co-authored by: @javiercn

Fixes dotnet/runtime#60479

---
1. this needs a corresponding change in the wasm targets to enable
   using `ComputeFilesToPublish`, instead of `Publish`.
radical and others added 2 commits October 18, 2021 20:50
…6_0.targets

Co-authored-by: Larry Ewing <lewing@microsoft.com>
…6_0.targets

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: once @lewing's suggestions are incorporated.

…6_0.targets

Co-authored-by: Larry Ewing <lewing@microsoft.com>
@lewing lewing changed the title [blazorwasm] Fix publishing project with lazy loaded assembly [release/6.0.1xx][blazorwasm] Fix publishing project with lazy loaded assembly Oct 18, 2021
@lewing lewing merged commit 5b5c3c1 into dotnet:release/6.0.1xx Oct 19, 2021
@radical radical deleted the fix-lazy-load branch October 19, 2021 15:31
radical added a commit to radical/runtime that referenced this pull request Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, dotnet-watch Servicing-approved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants