Having a strange crash on some machines using when printing via an application (WPF Windows desktop app, Win X64, Core 3.0)
I need to print a usercontrol silently (no print dialog popup) from a specified printer (currently just the printer name stored as text) I'm using the below code to do so.
var server = new PrintServer();
var queues = server.GetPrintQueues(new[] { EnumeratedPrintQueueTypes.Local });
if (queues.Any(Q => Q.FullName == ThePrinterName))
{
printDlg.PrintQueue = queues.Where(Q => Q.FullName == StaticData.PrinterName).First();
}
printDlg.PrintVisual(TheUserControl, PrintTitle);
However on some machines (I cant reproduce it) it causes a hard application crash below the level that WPF allows capturer / logging on.
Only logs of the error I can find are in event viewer like the below which I believe point to a heap corruption which "should" be mostly impossible in managed C# code so must be something else printing wise. I think it must be something relating to print visual/the print dialogue setup as printing via other methods (like printing an image) work fine.
Any pointers would be greatly appreciated!
Faulting application name: XXXXXXXXXXX.exe, version: 1.0.0.0, time stamp: 0x5e21e4b9
Faulting module name: ntdll.dll, version: 10.0.19041.1288, time stamp: 0xa280d1d6
Exception code: 0xc0000374
Fault offset: 0x00000000000ff199
Faulting process ID: 0x8a0
Faulting application start time: 0x01d816af6938c662
Faulting application path: C:\Users\OWNER\AppData\Local\Programs\XXXXXXXXXXX\XXXXXXXXXXX.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report ID: 7a3632ca-be4a-4515-934a-8939002284b9
Faulting package full name:
Faulting package-relative application ID:
Application: XXXXXXXXX.exe
CoreCLR Version: 4.700.20.6603
.NET Core Version: 3.0.3
Description: The process was terminated due to an internal error in the
.NET Runtime at IP XXXXXXXXX(XXXXXXXXX) with exit code c0000005.
Regards
Scott