Doraku / DefaultDocumentation

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

Crash because of long filename #57

Closed FlorianKummer closed 3 years ago

FlorianKummer commented 3 years ago

I tried to apply defaultdocumentation onto a quite large project. Unfortunately it crashed on functins with a lot of members; i suppose the reason is that the generated filename is far beyond the length limit of approx. 250 characters.

Wouldn't it be better to shorten such file names?

PS.: My Stack Trace:

C:\tmp\R>defaultdocumentation -a .\BoSSS.Foundation.dll -o .\doc
Unhandled exception. System.Exception: Error while writing documentation for BoSSS.Foundation.ISpatialOperator.GetOrderFromQuadOrderFunction(System.Collections.Generic.IEnumerable<BoSSS.Foundation.Basis>, System.Collections.Generic.IEnumerable<BoSSS.Foundation.Basis>, System.Collections.Generic.IEnumerable<BoSSS.Foundation.Basis>)
 ---> System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'C:\tmp\R\doc\BoSSS_Foundation_ISpatialOperator_GetOrderFromQuadOrderFunction(System_Collections_Generic_IEnumerable_BoSSS_Foundation_Basis__System_Collections_Generic_IEnumerable_BoSSS_Foundation_Basis__System_Collections_Generic_IEnumerable_BoSSS_Foundation_Basis_).md'
   at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
   at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path)
   at System.IO.File.WriteAllText(String path, String contents)
   at DefaultDocumentation.Writer.MarkdownWriter.WritePage(DirectoryInfo directory, DocItem item) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\MarkdownWriter.cs:line 650
   at DefaultDocumentation.Writer.DocItemWriter.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\DocItemWriter.cs:line 110
   --- End of inner exception stack trace ---
   at DefaultDocumentation.Writer.DocItemWriter.Execute() in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\DocItemWriter.cs:line 114
   at DefaultDocumentation.Generator.Execute(Settings settings) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 7
   at DefaultDocumentation.Program.<>c.<Main>b__0_2(SettingsArgs a) in D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 32
   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 23
Doraku commented 3 years ago

You can change the file name generation by setting the <DefaultDocumentationFileNameMode> property if you are using the msbuild package, or the --FileNameMode argument if you are using the console package. Here are the available options:

FullName is the default value as it is the one with the least collision chance and the more expressive names but as you said when you have methods with a lot of parameters you hit the windows file name limit. If you are ok with losing some expressiveness in your file names, you can try with one of the other value.

FlorianKummer commented 3 years ago

Thanks for the quick response, this works for me! Btw., very nice project!