dotnet / docfx

Static site generator for .NET API documentation.
https://dotnet.github.io/docfx/
MIT License
3.94k stars 840 forks source link

[Bug] DotnetApiCatalog.GenerateManagedReferenceYamlFiles() hangs indefinitely on 2.76.0 #9988

Closed jwfx closed 6 days ago

jwfx commented 1 month ago

Describe the bug Calling DotnetApiCatalog.GenerateManagedReferenceYamlFiles() from a C# application works when when referencing Docfx.App 2.75.3 but hangs indefinitely after restoring when updating to 2.76.0

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/jwfx/DocFxHangRepro
  2. dotnet run in DocFxHangRepro console app folder

Expected behavior GenerateManagedReferenceYamlFiles() should not hang.

Context (please complete the following information):

filzrev commented 1 month ago

It seems that issue caused by BuildHost related contentFiles (that introduced at Roslyn 4.9.2) are not copied to bin directories when using Docfx.App package.

As a workaround. Add following package dependencies to DocFxHangRepro.csproj.

<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.9.2" />

By adding these settings. related contentFiles are copied to bin directory.

I'll update following docs later. https://dotnet.github.io/docfx/index.html#use-the-nuget-library

jwfx commented 1 month ago

Thank you for your swift response.

The workaround does the trick.

filzrev commented 6 days ago

@yufeih Please close this issue. Because related document is updated by #9944.