系统事件查看器日志:
Application: iisexpress.exe CoreCLR Version: 6.0.3024.21525 .NET Version: 6.0.30 Description: The application requested process termination through System.Environment.FailFast(string message). Message: A callback was made on a garbage collected delegate of type 'WkHtmlToPdfDotNet!WkHtmlToPdfDotNet.StringCallback::Invoke'. Stack: at WkHtmlToPdfDotNet.WkHtmlModule.wkhtmltopdf_convert(IntPtr) at WkHtmlToPdfDotNet.WkHtmlModule.wkhtmltopdf_convert(IntPtr) at WkHtmlToPdfDotNet.WkHtmlModule.Convert(IntPtr) at WkHtmlToPdfDotNet.PdfTools.DoConversion(IntPtr) at WkHtmlToPdfDotNet.BasicConverter.Convert(WkHtmlToPdfDotNet.Contracts.IDocument) at WkHtmlToPdfDotNet.SynchronizedConverter.<>n__0(WkHtmlToPdfDotNet.Contracts.IDocument) at WkHtmlToPdfDotNet.SynchronizedConverter+<>c__DisplayClass4_0.<Convert>b__0() at System.Threading.Tasks.Task1[[System.Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean)
at System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean)
at System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler, Boolean)
at WkHtmlToPdfDotNet.SynchronizedConverter.<.ctor>b3_0()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()`
HTML字符串转换为PDF报错System.ExecutionEngineException。 多次调用业务代码
var result = PdfConverter.Convert(htmlToPdfDocument);
,批量导出PDF文件,抛出异常。异常内部代码:
public bool Convert(IntPtr converter) { return wkhtmltopdf_convert(converter); }
值为0x00000189098f64b0堆栈信息:
WkHtmlToPdfDotNet.dll!WkHtmlToPdfDotNet.WkHtmlModule.Convert(System.IntPtr converter) 行 94 C# WkHtmlToPdfDotNet.dll!WkHtmlToPdfDotNet.PdfTools.DoConversion(System.IntPtr converter) 行 130 C# WkHtmlToPdfDotNet.dll!WkHtmlToPdfDotNet.BasicConverter.Convert(WkHtmlToPdfDotNet.Contracts.IDocument document) 行 50 C# WkHtmlToPdfDotNet.dll!WkHtmlToPdfDotNet.SynchronizedConverter.Convert.AnonymousMethod__0() 行 37 C# System.Private.CoreLib.dll!System.Threading.Tasks.Task<byte[]>.InnerInvoke() 未知 System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) 未知 System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot, System.Threading.Thread threadPoolThread) 未知 System.Private.CoreLib.dll!System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued) 未知 System.Private.CoreLib.dll!System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued) 未知 System.Private.CoreLib.dll!System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler scheduler, bool waitForCompletion) 未知 WkHtmlToPdfDotNet.dll!WkHtmlToPdfDotNet.SynchronizedConverter..ctor.AnonymousMethod__3_0() 行 32 C# System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread threadPoolThread, System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) 未知 System.Private.CoreLib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot, System.Threading.Thread threadPoolThread) 未知 System.Private.CoreLib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() 未知 System.Private.CoreLib.dll!System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() 未知 System.Private.CoreLib.dll!System.Threading.Thread.StartCallback() 未知
系统事件查看器日志:
Application: iisexpress.exe CoreCLR Version: 6.0.3024.21525 .NET Version: 6.0.30 Description: The application requested process termination through System.Environment.FailFast(string message). Message: A callback was made on a garbage collected delegate of type 'WkHtmlToPdfDotNet!WkHtmlToPdfDotNet.StringCallback::Invoke'. Stack: at WkHtmlToPdfDotNet.WkHtmlModule.wkhtmltopdf_convert(IntPtr) at WkHtmlToPdfDotNet.WkHtmlModule.wkhtmltopdf_convert(IntPtr) at WkHtmlToPdfDotNet.WkHtmlModule.Convert(IntPtr) at WkHtmlToPdfDotNet.PdfTools.DoConversion(IntPtr) at WkHtmlToPdfDotNet.BasicConverter.Convert(WkHtmlToPdfDotNet.Contracts.IDocument) at WkHtmlToPdfDotNet.SynchronizedConverter.<>n__0(WkHtmlToPdfDotNet.Contracts.IDocument) at WkHtmlToPdfDotNet.SynchronizedConverter+<>c__DisplayClass4_0.<Convert>b__0() at System.Threading.Tasks.Task
1[[System.Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].InnerInvoke() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread) at System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.TaskScheduler.TryRunInline(System.Threading.Tasks.Task, Boolean) at System.Threading.Tasks.Task.InternalRunSynchronously(System.Threading.Tasks.TaskScheduler, Boolean) at WkHtmlToPdfDotNet.SynchronizedConverter.<.ctor>b3_0() at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(System.Threading.Thread, System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef, System.Threading.Thread) at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool+WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()`