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

Stackoverflow if there is a circular dependency between inheritdocs #7035

Closed
cesarsouza opened this issue Jan 30, 2021 · 5 comments
Closed
Labels
dotnet Generate .NET API reference docs
Milestone

Comments

@cesarsouza
Copy link

cesarsouza commented Jan 30, 2021

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:

  1. 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.

@ghost
Copy link

ghost commented May 11, 2021

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

@thetestgame
Copy link

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.

@eriksorngard
Copy link

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?

@laura-rodriguez
Copy link

Has anyone found a workaround for this issue?

@eriksorngard
Copy link

I still have to run DocFX twice. Now on version 2.59.2. First run throws the StackOverflowException. The second run works fine.

@yufeih yufeih added the dotnet Generate .NET API reference docs label Dec 15, 2022
@yufeih yufeih added this to the Backlog milestone Feb 6, 2023
@yufeih yufeih closed this as completed Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet Generate .NET API reference docs
Projects
None yet
Development

No branches or pull requests

5 participants