dotnet / docfx

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

[Bug] Four separate errors and two warnings to do with: "namespaceLayout": "nested" in version v2.63.0 and v2.63.1 #8544

Closed CopilotCoding closed 1 year ago

CopilotCoding commented 1 year ago

Describe the bug

Four separate errors and two warnings relating to ZedGraph ZedGraphControl and .net 7.0 as well as issues with transforming generated models and MSBUILD problems. Just tested on the new version v2.63.1 and it has the exact same issues as version v2.63.0 sadly.

To Reproduce

  1. Git clone the repository https://github.com/colgreen/sharpneat

  2. Install docfx: dotnet tool update -g docfx

  3. Enter command: docfx init --quiet

  4. Modify the docfx.json so the top of the file looks like:

{ "metadata": [ { "src": [ { "files": [ "**.sln" ], "src": "../" } ], "dest": "api", "includePrivateMembers": false, "disableGitFeatures": false, "disableDefaultFilter": false, "noRestore": false, "namespaceLayout": "nested" } ], "build": {

  1. Enter command (modify pathto to your path to the docfx.json): docfx pathto/docfx.json --serve

  2. Enjoy the two errors that you get.

  3. Try to fix errors by updating nuget packages to https://www.nuget.org/packages/ZedGraph/6.0.0-alpha0001 version in the nuget package manager.

  4. More errors, try to fix these errors by doing this https://github.com/dotnet/docfx/issues/8540

  5. Unable to install MSBUILD tools 2022 for my OS

  6. Post issue on github repository and hope someone can fix this for the next version of docfx or zedgraph or msbuild tools or whatever is the issue here.

Expected behavior

Solution loads normally, dotnet restores and then docfx translates all models without errors.

Context (please complete the following information):

Additional context

When generating documentation using https://github.com/dotnet/docfx with the metadata parameter "namespaceLayout": "nested" it creates two errors:

Applying templates to 408 model(s)...

\sharpneat\src\docfx_project\api\SharpNeat.Neat.yml: error ApplyTemplatePreprocessorError: Error transforming model generated from "api/SharpNeat.Neat.yml" using "ManagedReference.html.primary.js". To get the detailed raw model, please run docfx with debug mode --debug. Error running Transform function inside template preprocessor: Cannot read property 'toLowerCase' of undefined

\sharpneat\src\docfx_project\api\SharpNeat.Tasks.yml: error ApplyTemplatePreprocessorError: Error transforming model generated from "api/SharpNeat.Tasks.yml" using "ManagedReference.html.primary.js". To get the detailed raw model, please run docfx with debug mode --debug. Error running Transform function inside template preprocessor: Cannot read property 'toLowerCase' of undefined

I did some debugging and found the issues stem from visual studio automatically installing nuget packages for net versions lower than net 7 I get these two warnings:

Severity Code Description Project File Line Suppression State Warning NU1701 Package 'ZedGraph 5.1.7' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0-windows7.0'. This package may not be fully compatible with your project. SharpNeat.Windows.App \sharpneat\src\SharpNeat.Windows.App\SharpNeat.Windows.App.csproj 1

Severity Code Description Project File Line Suppression State Warning NU1701 Package 'ZedGraph 5.1.7' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net7.0-windows7.0'. This package may not be fully compatible with your project. SharpNeat.Tasks.Windows \sharpneat\src\SharpNeat.Tasks.Windows\SharpNeat.Tasks.Windows.csproj 1

I tried to update both installed nuget packages to https://www.nuget.org/packages/ZedGraph/6.0.0-alpha0001 version in the nuget package manager but then I encountered more errors:

this.zed = new ZedGraph.ZedGraphControl();

Severity Code Description Project File Line Suppression State Error CS0234 The type or namespace name 'ZedGraphControl' does not exist in the namespace 'ZedGraph' (are you missing an assembly reference?) SharpNeat.Tasks.Windows \sharpneat\src\SharpNeat.Tasks.Windows\FunctionRegression\FnRegressionControl.Designer.cs 31 Active

private ZedGraph.ZedGraphControl zed;

Severity Code Description Project File Line Suppression State Error CS0234 The type or namespace name 'ZedGraphControl' does not exist in the namespace 'ZedGraph' (are you missing an assembly reference?) SharpNeat.Tasks.Windows C:\GITHUBDESKTOP\sharpneat\src\SharpNeat.Tasks.Windows\FunctionRegression\FnRegressionControl.Designer.cs 62 Active

I did even further investigation into the issue and found this on how to fix it:

https://github.com/dotnet/docfx/issues/8540

Unfortunately MSBUILD tools 2022 is not supported on my OS so I could do no further testing on these issues.

Very frustrating issue.

yufeih commented 1 year ago

dup of https://github.com/dotnet/docfx/issues/8540