Doraku / DefaultDocumentation

Create a simple markdown documentation from the Visual Studio xml one.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail only when using dotnet tool (Image is too small)

emerxom opened this issue · comments

I works great installing the nuget package..

but when I try to do the same using dotnet tool cli I got this error
defaultdocumentation -o "code docs" -a .\Folder\Solution.csproj

defaultdocumentation : Unhandled exception. System.BadImageFormatException: Image is too small.
At line:1 char:1
+ defaultdocumentation -o "code docs" -a .\Folder\Solution.cs ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Unhandled excep...e is too small.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
   at System.Reflection.Throw.ImageTooSmall()
   at System.Reflection.PortableExecutable.SectionHeader..ctor(PEBinaryReader& reader)
   at System.Reflection.PortableExecutable.PEHeaders.ReadSectionHeaders(PEBinaryReader& reader)
   at System.Reflection.PortableExecutable.PEHeaders..ctor(Stream peStream, Int32 size, Boolean isLoadedImage)
   at System.Reflection.PortableExecutable.PEReader.InitializePEHeaders()
   at System.Reflection.PortableExecutable.PEReader.get_HasMetadata()
   at ICSharpCode.Decompiler.Metadata.PEFile..ctor(String fileName, PEReader reader, MetadataReaderOptions metadataOptions)
   at ICSharpCode.Decompiler.Metadata.PEFile..ctor(String fileName, Stream stream, PEStreamOptions streamOptions, MetadataReaderOptions metadataOptions)
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.LoadPEFile(String fileName, DecompilerSettings settings)
   at ICSharpCode.Decompiler.CSharp.CSharpDecompiler.CreateTypeSystemFromFile(String fileName, DecompilerSettings settings)
   at DefaultDocumentation.DocItemReader..ctor(Settings settings) in 
D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\DocItemReader.cs:line 46
   at DefaultDocumentation.DocItemReader.GetItems(Settings settings) in 
D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\DocItemReader.cs:line 318
   at DefaultDocumentation.Writer.DocItemWriter..ctor(Settings settings) in 
D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\DocItemWriter.cs:line 25
   at DefaultDocumentation.Writer.MarkdownWriter..ctor(Settings settings) in 
D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Writer\MarkdownWriter.cs:line 29
   at DefaultDocumentation.Generator.Execute(Settings settings) in 
D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Common\Generator.cs:line 19
   at DefaultDocumentation.Program.<>c.<Main>b__0_2(SettingsArgs a) in 
D:\a\DefaultDocumentation\DefaultDocumentation\source\DefaultDocumentation.Console\Program.cs:line 33
   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 24

Hello, hum the -a expect the binary, not the csproj, can you try again by passing it the actual csproj output?

It worked.. 😁

I'm trying to run it in several repos so it would be nice to pass the solution and have the option to check each project inside the solution and get the parameter like DefaultDocumentationGeneratedAccessModifiers from them and them it creates the files as needed. (since I only have one solution per repo it would be easy to find the correct file)

I have an centralized documentation that uses the generated *.md from all our tools.
So everything is dynamic.

thanks

Making it works by passing the sln/csproj instead of the compiled assembly would make it kind of weird. Let's say you call it on a sln/csproj which wasn't compiled already is it supposed to fail or compile it for you? If it should fail why even accept those instead of the actual dll (whatever the way it was produced, it's not its responsibility). If it should compile it, how is it supposed to know how you want it compiled?
If your problem is the existence of configuration for DefaultDocumentation in the csproj that the dotnet tool can't access, the next version (already in beta for a long time, sorry haven't got the time to finish it and release it properly yet) will work with an external json configuration file which can be used by both. The same configuration file could even be used by multiple project. Maybe that would work for you?

that would be perfect. 🙂