Closed chrisvanderpennen closed 1 year ago
Thank you for reporting this bug! Your analysis is absolutely correct, would you like to send a PR for a fix?
Sure, I can do that.
While testing I found this would also throw if the configuration didn't provide a path for wkhtmltopdf.
I've restored the logic used in 2.59.4, from https://github.com/dotnet/docfx/blob/v2.59.4/src/docfx/SubCommands/PdfCommand.cs#L30 and https://github.com/dotnet/docfx/blob/v2.59.4/src/docfx/Extensions/StringExtensions.cs, as a private static method on RunPdf - please let me know if you would like me to factor this differently :)
Describe the bug At https://github.com/dotnet/docfx/blob/main/src/Microsoft.DocAsCode.App/RunPdf.cs#L18,
config.BaseDirectory
is passed as the first argument to Path.Combine but it is always null, so it throws ArgumentNullException.Based on what RunBuild.cs is doing, I believe the fix would be to move https://github.com/dotnet/docfx/blob/main/src/Microsoft.DocAsCode.App/RunPdf.cs#L32-L34 to the top of the method, and pass
EnvironmentContext.BaseDirectory
to Path.Combine instead.To Reproduce Steps to reproduce the behavior:
Expected behavior A PDF to be generated.
Context (please complete the following information):
OS: Ubuntu 22.04 / WSL2
Docfx version: 2.60.0
.NET version: .NET 6.0
docfx.json
configAdditional context contents of
Program.cs
: