I have an application that was written in VS 2005 (C#). Works fine, it calls a 3rd Party dll. Now that I've converted it to VS 2008 (using the wizard), I get the following error when trying to instantiate the 3rd party dll.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Not sure where to even start debugging this. Can anyone point me in the right direction?
EDIT: As a side note it does the exact same thing under VS 2010.
EDIT: Both VS 2005 and VS 2008 projects using the same code target .NET 2.0 Framework
EDIt: It's an ActiveX library called LPDFCTRLLib. I've simply added it under References and create a new instance of it:
public LPDFCTRLLib.LPDFWndClass olpdf = null;
//and later in my code
//...
//this is where it fails
olpdf = new LPDFCTRLLib.LPDFWndClass();
EDIT: Stack Trace
at pcl2pdf.Form1.convertPCL(String inputFile, String outputFile) in C:\junk\pcl2pdf\pcl2pdf\pcl2pdf\Form1.cs:line 29
at pcl2pdf.Form1.Form1_Load(Object sender, EventArgs e) in C:\junk\pcl2pdf\pcl2pdf\pcl2pdf\Form1.cs:line 24
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at pcl2pdf.Program.Main() in C:\junk\pcl2pdf\pcl2pdf\pcl2pdf\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()