2

I have a .NET service that references XpdfPrint.dll that is used for printing. The print method of XpdfPrint library is executed in separate thread that looks like this:

Thread xPdfPrintThread = new Thread(() => 
{
    try
    {
        xPDF.printPDF4();
    }
    catch (COMException e)
    {
        // check for the specific errorcode and log an error
    }
 });

This worked good and well until I changed target framework from .NET 3.5 to .NET 4.5.2. Now, the call to printPDF4() is failing with:

Exception: Error HRESULT E_FAIL has returned from a call to a COM component.

If I take the call out of the thread and execute it, it completes fine. Any idea on why upgrading .NET to 4.5.2 would break this?

Update: Instantiating the COM object within the thread instead of outside the thread resolves the issue. I still have no clue why this behaves differently in .NET 4.5.2.

Srki Rakic
  • 499
  • 5
  • 15

0 Answers0