Flayms / Markdown2Pdf

.NET library for converting markdown to PDF.
https://www.nuget.org/packages/Markdown2Pdf/
MIT License
5 stars 1 forks source link

Error Await mdconvert.Convert(file.md) #67

Closed INOPIAE closed 3 months ago

INOPIAE commented 4 months ago

After update from v 1.3.0 to 2.0.0 I get this error.

System.ComponentModel.Win32Exception
  HResult=0x80004005
  Nachricht = An error occurred trying to start process 'C:\...\bin\Debug\net6.0-windows\Chrome\Win64-123.0.6312.86\chrome-win64\chrome.exe' with working directory 'C:\...I\bin\Debug\net6.0-windows'. Das System kann die angegebene Datei nicht finden.
  Quelle = System.Diagnostics.Process
  Stapelüberwachung:
   bei System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   bei System.Diagnostics.Process.Start()
   bei PuppeteerSharp.States.ProcessStartingState.<StartCoreAsync>d__6.MoveNext()
   bei PuppeteerSharp.Launcher.<LaunchAsync>d__8.MoveNext()
   bei PuppeteerSharp.Launcher.<LaunchAsync>d__8.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_CreateBrowserAsync>d__50.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_GeneratePdfAsync>d__47.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_ConvertInternal>d__44.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<_Convert>d__43.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<Convert>d__40.MoveNext()
   bei Markdown2Pdf.Markdown2PdfConverter.<Convert>d__39.MoveNext()
   bei inoPBI.FrmPDF.VB$StateMachine_90_CmdDocumentation_Click.MoveNext() in C:\...\FrmPDF.vb: Zeile64

Line 64 is Dim strPDF = Await mdconvert.Convert(TxtFileDocu.Text)

I get the same error running the unit tests on branch main and develop

System.ComponentModel.Win32Exception : An error occurred trying to start process 'C:\...\Markdown2Pdf\Markdown2Pdf.Tests\bin\Debug\net8.0\Chrome\Win64-123.0.6312.86\chrome-win64\chrome.exe' with working directory 'C:\...\Markdown2Pdf\Markdown2Pdf.Tests\bin\Debug\net8.0'. Das System kann die angegebene Datei nicht finden.

Process.StartWithCreateProcess(ProcessStartInfo startInfo)
ProcessStartingState.StartCoreAsync(LauncherBase p) Zeile 68
Launcher.LaunchAsync(LaunchOptions options) Zeile 66
Launcher.LaunchAsync(LaunchOptions options) Zeile 99
Markdown2PdfConverter._CreateBrowserAsync() Zeile 314
Markdown2PdfConverter._GeneratePdfAsync(String htmlFilePath, String outputFilePath) Zeile 217
Markdown2PdfConverter._ConvertInternal(String outputFilePath, String markdownContent, String markdownFilePath) Zeile 176
Markdown2PdfConverter._Convert(String outputFilePath, String markdownContent, String markdownFilePath) Zeile 158
Markdown2PdfConverter.Convert(String markdownFilePath, String outputFilePath) Zeile 120
Markdown2PdfConverter.Convert(String markdownFilePath) Zeile 103
HtmlTests.TestGeneralFunctionality() Zeile 20
GenericAdapter`1.GetResult()
AsyncToSyncAdapter.Await(Func`1 invoke)
TestMethodCommand.RunTestMethod(TestExecutionContext context)
TestMethodCommand.Execute(TestExecutionContext context)
<>c__DisplayClass1_0.<Execute>b__0()
DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

running with Microsoft Visual Studio Community 2022 (64-Bit) - Current Version 17.9.5

Flayms commented 4 months ago

Chrome and Puppeteer had changes on how headless mode works. Delete Markdown2Pdf\Markdown2Pdf.Tests\bin\Debug\net8.0 and try running again. (Also run an npm install in the build dir after rebuild - some new tests require it)

INOPIAE commented 4 months ago

Deleting the folder solved my problem. The but after running npm install I still have 4 Errors in the unit tests.

Flayms commented 4 months ago

That's the tests which check if the local modules work, on my machine and in the Github Actions runner they're passing.

Did u run the command within the net8.0 directory? Can you check if the node_modules dir exists and if it contains packages? Otherwise, what is the error message?

INOPIAE commented 4 months ago

Yes running npm install on the net8.0 directory in Markdown2Pdf.Tests\bin\Debug worked. All test are now running without errors

Should this problem solving solution be documented somewhere or pointed out a bit clearer in the documentation. As I was not interrested in using the modules options I was not aware of the depedencies for the unit test.

Flayms commented 4 months ago

It's described in the failure message, we can also add it to the documentation though.

INOPIAE commented 4 months ago

We should add it to the documentaion in the "new" Wiki.

INOPIAE commented 3 months ago

I ran in the same problematic again while updating from v.0.0.0 to 2.1.0

After deleting, rebuild and npm install it worked.

Does is it make sense to have a powerscript file to to the cleanups?

Flayms commented 3 months ago

Added a script for the install, I think for the rebuild this is smth a dev can try by hand.