Stackoverflow if there is a circular dependency between inheritdocs
Operating System: (Windows or Linux or MacOS)
Windows
DocFX Version Used: 2.56.6
Template used: (default or statictoc or contain custom template)
default
Steps to Reproduce:
- Try to run docfx with any of the following two classes below:
public class Class1
{
/// <inheritdoc cref="Method"/>
public void Method()
{
}
}
or
public class Class1
{
/// <inheritdoc cref="B"/>
public void A()
{
}
/// <inheritdoc cref="A"/>
public void B()
{
}
}
Expected Behavior:
While it seems obvious that there are problems with the above examples, DocFX currently crashes with a stackoverflow instead of reporting where the problems are. While the above examples have been simplified, problems like those can be very hard to spot in the middle of a solution with many method overloads and complex class hierarchies.
Actual Behavior:
1> [21-01-30 11:08:48.798]Verbose:[MetadataCommand.ExtractMetadata]Successfully generated metadata C:/Users/cdesouza/source/repos/ConsoleApp1/ClassLibrary1/obj/xdoc/cache/obj for ClassLibrary1
1> [21-01-30 11:08:48.812]Verbose:[MetadataCommand.ExtractMetadata]Completed MergeMetadata in 2.6608 milliseconds.
1> [21-01-30 11:08:48.812]Verbose:[MetadataCommand.ExtractMetadata]Completed MergeReference in 0.8131 milliseconds.
1>
1> Process is terminated due to StackOverflowException.
Have the same issue. But for some reasons, second run builds normal.
PS C:\Users\klnsk\Desktop\proj\docs\docfx> docfx .\docfx.json
[21-05-11 12:52:10.548]Info:[MetadataCommand.ExtractMetadata]Using msbuild C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin as inner compiler.
[21-05-11 12:52:10.815]Info:[MetadataCommand.ExtractMetadata]Loading projects...
[21-05-11 12:52:14.328]Info:[MetadataCommand.ExtractMetadata]Generating metadata for each project...
Process is terminated due to StackOverflowException.
PS C:\Users\klnsk\Desktop\proj\docs\docfx> docfx .\docfx.json
[21-05-11 12:55:54.156]Info:[MetadataCommand.ExtractMetadata]Using msbuild C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin as inner compiler.
[21-05-11 12:55:54.425]Info:[MetadataCommand.ExtractMetadata]Loading projects...
[21-05-11 12:55:58.035]Info:[MetadataCommand.ExtractMetadata]Generating metadata for each project...
[21-05-11 12:55:59.095]Info:[MetadataCommand.ExtractMetadata]'C:/Users/klnsk/Desktop/proj/src/Test/Test.csproj' keep up-to-date since '11.05.2021 0:52:15', cached intermediate result 'C:/Users/klnsk/Desktop/proj/src/Test/obj/xdoc/cache/obj\rbdcxq4z.ldh' is used.
[21-05-11 12:56:01.715]Info:[MetadataCommand]Completed Scope:MetadataCommand in 7581,1186 milliseconds.
...
Build succeeded.
0 Warning(s)
0 Error(s)
DocFX Version Used: 2.57.2
I am also having the same issue with version 2.58. It only runs all the way through if I run the metadata command independent of the build command which defeats the point of the Visual Studio integration.
I may have the same issue with one assembly. First run throws a StackOverflowException, but the second completes with no issues. Is it possible to see the StackOverflowException's call stack to investigate what happened?
Has anyone found a workaround for this issue?
I still have to run DocFX twice. Now on version 2.59.2. First run throws the StackOverflowException. The second run works fine.