dotnet / docfx

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

metadata filename clash between namespace and class name - macOS and docker containers with mounted volumes on Windows or macOS hosts. #6852

Open farcasclaudiu opened 3 years ago

farcasclaudiu commented 3 years ago

Operating System: Windows or MacOS Docker containers with mounted volumes on Windows or macOS hosts.

DocFX Version Used: docfx 2.56.6.0

Template used: default

Steps to Reproduce:

  1. checkout the sample project that repro the issue from here - https://github.com/farcasclaudiu/docfx_conflict
  2. build project (dotnet build) - should succeed
  3. run docfx ./docfx_project/docfx.json --force --debug command It fails.

Expected Behavior: to generate the apidoc _site without any error.

Actual Behavior: error in command line: [20-12-04 01:01:31.963]Error:[BuildCommand.BuildCore.Build Document.LinkPhaseHandlerWithIncremental.Apply Templates](api/docfx_conflict.yml)Error transforming model "/var/folders/87/y9_3c0qn76g9wlzzg5m8fsl40000gn/T/docfx/rawmodel/api/docfx_conflict.raw.json" generated from "api/docfx_conflict.yml" using "ManagedReference.html.primary.js". Error running Transform function inside template preprocessor: type is undefined

Cause of the error The error message is not very helpful unfortunately. The error is caused because in the project coexist a namespace (docfx_conflict.member) and a class (docfx_conflict.Member) and docfx generated yaml metadata files for both of these, but the OS filesystem is case insensitive. One will be overwritten I guess.

Any idea?

georgius commented 3 years ago

I just tested this problem on Windows, docfx 2.56.6.0 and no error occurred. Is there still error in your environment?

farcasclaudiu commented 3 years ago

just tested on Mac with docfx version 2.56.6.0 and the error is the same.

georgius commented 3 years ago

just tested on Mac with docfx version 2.56.6.0 and the error is the same.

Can you test it also on Windows (just for confirmation that on Windows it is working)?

farcasclaudiu commented 3 years ago

I just tested on Windows and it works fine. But not on macOS (Catalina).

georgius commented 3 years ago

I just tested on Windows and it works fine. But not no Mac.

In this case you should edit your first post and change Operating System. Unfortunately, I don't have MacOS machine to debug. I try to create virtual machine with MacOS, but this will take some time.

farcasclaudiu commented 3 years ago

I updated the https://github.com/farcasclaudiu/docfx_conflict project with another similar case: Docker containers with mounted volumes on Windows or macOS hosts.

Error:

[20-12-14 09:18:39.430]Error:Error extracting metadata for /src/docfx_conflict/docfx_conflict.csproj: System.IO.IOException: Could not create file "/src/docfx_project/api/docfx_conflict.member.yml". File already exists.
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int)
  at System.IO.File.Create (System.String path, System.Int32 bufferSize) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.IO.File.Create (System.String path) [0x00000] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at Microsoft.DocAsCode.Plugins.RootedFileAbstractLayer.Create (System.String file) [0x0001e] in <a2b39844b9794d2aa3575d5ba2d3e933>:0
  at Microsoft.DocAsCode.Plugins.FileAbstractLayerExtensions.CreateText (Microsoft.DocAsCode.Plugins.IFileAbstractLayer fal, System.String file) [0x00000] in <a2b39844b9794d2aa3575d5ba2d3e933>:0
  at Microsoft.DocAsCode.Common.YamlUtility.Serialize (System.String path, System.Object graph, System.String comments) [0x00005] in <0480e2a23e5145f69c3030fbeb298dc8>:0
  at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker+<ResolveAndExportYamlMetadata>d__19.MoveNext () [0x00170] in <5c540df9fbb940bba18cdc38a60fa384>:0
  at System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) [0x00059] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00062] in <d13c8b563008422a8c5aaec0a74089cc>:0
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00018] in <c5bd4c865d5d48d3b3ebe4d522fd6bd7>:0
  at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.SaveAllMembersFromCacheAsync () [0x00be1] in <5c540df9fbb940bba18cdc38a60fa384>:0
  at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.ExtractMetadataAsync () [0x000c0] in <5c540df9fbb940bba18cdc38a60fa384>:0