I actually need some further assistance with this. So let me explain exactly what I'm doing here. I've developed a dll that uses the PDFXCore.x86.API.dll to do some very specific functionality. The dll has two pretty simple methods in it which take in a document and then return some data based on the processing of the document. Not doing OCR or anything crazy, just scanning the form for certain fields/potentially adding a field and then returning some data about the form to the caller and the modified form.
The issue I'm running into here is that if I include the Garbage Collector call inside my method before returning a response to the caller, calling the method causes an unhandeled exception in PDFXCore.x86.API.dll. Here is a snippet of the code that causes that exception:
Code: Select all
IPXC_Inst ipxcInst = new PXC_Inst();
ipxcInst.Init(pdfKey);
IPXC_Document doc = null;
[do work]
doc.Close();
doc = null;
ipxcInst.Finalize();
ipxcInst = null;
GC.Collect();
GC.WaitForPendingFinalizers();
return something
Now if I take the GC call out and just leave everything else, the call to the method runs fine, but then the application consuming my DLL throws an unhandled exception when closing their app. Here is that code:
Code: Select all
IPXC_Inst ipxcInst = new PXC_Inst();
ipxcInst.Init(pdfKey);
IPXC_Document doc = null;
[do work]
doc.Close();
doc = null;
ipxcInst.Finalize();
ipxcInst = null;
return something
So either way, it seems that when the GC is getting called, the PDFXCore.API.x86.dll is throwing an unhandled exception, whether it's me calling it directly in my dll, or it getting called naturally when the calling application closed their app.
I know you asked the question before about if I could reproduce this in the Core API Demo app, and I cannot, but the major difference being that I'm on initiating the instance of the PXC_Inst when the method is called instead of with the opening and closing of a form. here are the lines from the demo app where it initiates the PXC_inst and then closes it, and I don't really see much difference:
Code: Select all
public PXC_Inst m_pxcInst = null;
m_pxcInst = new PXC_Inst();
m_pxcInst.Init(m_sLicenseKey);
CloseDocument(); -- method call that just closes and nulls the IPXC_Document instance
m_pxcInst.Finalize();
m_pxcInst = null;
GC.Collect();
GC.WaitForPendingFinalizers();
I would really appreciate any assistance you can provide in finding a resolution to this. Happy to share whatever needs shared to help further the effort.
Thanks,
Phil