In my wrapper I have a simple function:
Code: Select all
public IPXC_Document OpenPDF(String sFilePath)
{
IPXC_Document pDoc = g_Inst.OpenDocumentFromFile(sFilePath, null);
return pDoc;
}
The problem occurs when the files are edited and saved, where a FileSystemWatcher notices the update and the program attempts to rebuild the objects in memory from the file. The above function is called again and now results in the following exception:
Code: Select all
System.Runtime.InteropServices.COMException was unhandled
HResult=-2147352568
Message=Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE))
Source=TAMLetterManager
ErrorCode=-2147352568
StackTrace:
at PDFXCoreAPI.IPXC_Inst.OpenDocumentFromFile(String lpszFileName, IPXC_DocAuthCallback pAuthCallback, IProgressMon pProgressMon, UInt32 nFlags, UInt32 nRestrictPerms)
at TAMLetterManager.PDF_Wrapper.OpenPDF(String sFilePath) in c:\Users\haverjes\Documents\Visual Studio 2012\Projects\TAMLetterHandler\TAMLetterManager\PDF_Wrapper.cs:line 32
at TAMLetterManager.HCS_LetterPacket.updateFromFile() in c:\Users\haverjes\Documents\Visual Studio 2012\Projects\TAMLetterHandler\TAMLetterManager\HCS_LetterPacket.cs:line 162
at TAMLetterManager.HCS_LetterManager.onLetterUpdate(Object source, FileSystemEventArgs e) in c:\Users\haverjes\Documents\Visual Studio 2012\Projects\TAMLetterHandler\TAMLetterManager\HCS_LetterManager.cs:line 379
at System.IO.FileSystemEventHandler.Invoke(Object sender, FileSystemEventArgs e)
at System.IO.FileSystemWatcher.OnChanged(FileSystemEventArgs e)
at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(Int32 action, String name)
at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
InnerException: