runtime: Freezes When Blazor WebAssembly publish

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I try to deploy my Blazor WebAssembly from Visual Studio to Azure, it freezes midway through. Here is the information that will be displayed in the output window at the end.

–enable-serialization-discovery --skip-unresolved true --notrimwarn --link-attributes “C:\Program Files\dotnet\sdk\7.0.401\Sdks\Microsoft.NET.ILLink.Tasks\build\6.0_suppressions.xml”

When I tried the dotnet publish command, it also freezes.

After adding the following to WebAssembly’s csproj, the problem no longer occurs, so I think it is stuck in the middle of trimming.

<PublishTrimmed>false</PublishTrimmed>

The dll referenced by WebAssembly makes heavy use of reflection. That dll is also created by me and also references Microsoft.CodeAnalysis.CSharp.

Since it is a commercial software, I cannot attach those codes. Also, since I have not determined which code caused the problem, I cannot attach the minimum reproduction environment.

WebAssembly and the dlls it references are made with .Net6.

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 18 (13 by maintainers)

Commits related to this issue

Most upvoted comments

I created a PR to port the relevant fix to 7.0: https://github.com/dotnet/linker/pull/3231

So porting trimmer/analyzer parts of https://github.com/dotnet/runtime/pull/82818 fixed the problem for trimmer. Analyzer hangs on a different test from the suite - so it’s probably the other bug to port.

This a bug - we need to fix it. There’s nothing wrong with the pattern as such, it’s just uncovering a limitation in the trim analysis.

Thanks a lot - I can repro it as well. Still looking through what’s going on… and why it loops.