Doraku / DefaultDocumentation

Create a simple markdown documentation from the Visual Studio xml one.
MIT No Attribution
160 stars 26 forks source link

Unhandled exception when processing file #125

Closed CalvinWilkinson closed 10 months ago

CalvinWilkinson commented 2 years ago

Description:

Hello!! I am currently looking to generate API documentation for my eventual website for my open source project Velaptor, as well as other projects that I have and I have been trying out different markdown generators.

During my time trying out your tool, (which so far is fantastic), I ran into an issue with a console log message while using your dotnet tool.

The idea I was going with was to find a tool to generate all of the markdown files for my csharp code and then I could use those in docusaurus

The error is below:

2022-08-22 16:26:57.7313|INFO|DefaultDocumentation|Sections that will be used:
  DefaultDocumentation.Markdown.Sections.HeaderSection, DefaultDocumentation.Markdown, Version=0.8.2.0, Culture=neutral, PublicKeyToken=0ab8f459261ccb3c
  DefaultDocumentation.Markdown.Sections.DefaultSection, DefaultDocumentation.Markdown, Version=0.8.2.0, Culture=neutral, PublicKeyToken=0ab8f459261ccb3c
Unhandled exception. System.Exception: Error while writing documentation for Velaptor.Services.BatchServiceManager.BatchServiceManager(Velaptor.Services.IBatchingService<Velaptor.OpenGL.TextureBatchItem>, Velaptor.Services.IBatchingService<Velaptor.OpenGL.FontGlyphBatchItem>, Velaptor.Services.IBatchingService<Velaptor.Graphics.RectShape>)
 ---> System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'K:\SOFTWARE DEVELOPMENT\TESTING\api-docs-research\DefaultDocumentation\md-result\Velaptor.Services.BatchServiceManager.BatchServiceManager(Velaptor.Services.IBatchingService_Velaptor.OpenGL.TextureBatchItem_,Velaptor.Services.IBatchingService_Velaptor.OpenGL.FontGlyphBatchItem_,Velaptor.Services.IBatchingService_Velaptor.Graphics.RectShape_).md'
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.File.WriteAllText(String path, String contents)
   at DefaultDocumentation.Generator.WritePage(DocItem item, StringBuilder builder) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 140
   at DefaultDocumentation.Generator.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 180
   --- End of inner exception stack trace ---
   at DefaultDocumentation.Generator.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 184
   at DefaultDocumentation.Generator.Execute(Target loggerTarget, IRawSettings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 206
   at DefaultDocumentation.Program.<>c.<Main>b__0_1(SettingsArgs a) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 24
   at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult`1 result, Action`1 action)
   at DefaultDocumentation.Program.Main(String[] args) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 18

How to Reproduce Issue:

  1. Goto my project link above
  2. Grab only the Velaptor project in the entire solution and put it into a folder for testing
  3. Run your tool using the global dotnet tool using the command defaultdocumentation -a ./Velaptor/bin/Debug/net6.0/Velaptor.dll -o md-result in the testing folder.
    • I used powershell and was on windows using windows terminal
  4. Everything is generated into the output folder of your choosing, but in the console output, you will see the exception displayed above.

If you need any other information, please let me know.

Doraku commented 2 years ago

Hello, seeing the file name is it's probably an issue with it being too long and windows complains when trying to create it (while giving a not so clear exception). For such case you can change the FileNameFactory used to generate files with a shorter name.

CalvinWilkinson commented 2 years ago

Hello, seeing the file name is it's probably an issue with it being too long and windows complains when trying to create it (while giving a not so clear exception). For such case you can change the FileNameFactory used to generate files with a shorter name.

I will give that a shot!! Thanks @Doraku!!