PInvoke Error during PDF Export


10-24-2005, 6:12 PM
Using ActiveReports 2.0 SP1 (Trial Version - I own AR1.0 and am planning on upgrading to use VS2005).  I'm using VS2005 RC. I'm getting the following error on a PDF Export:

A call to PInvoke function 'ActiveReports.PdfExport!-1h.-b1be::SelectObject' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

Below is the code I'm using in a simplified scenario:

using System;
using System.Collections.Generic;
using System.Text;
using DataDynamics.ActiveReports.Export.Pdf;

namespace Test {
   class Program {
      
static void Main( string [] args) {
         ActiveReport1 report1 = new ActiveReport1 ();
         report1.Run();
         PdfExport export = new PdfExport ();
         export.Export(report1.Document,
@"c:\temp\test4.pdf" );
      }
   }
}

The report -- "ActiveReport1" in the code sample above -- is a completely blank report.  This shows, I think, that there is nothing in the report that's causing this problem.

Has anyone else had this error?  Is there a fix or work-around?

Thanks for your help.

Re: PInvoke Error during PDF Export


10-24-2005, 8:23 PM
Please see the following announcement for VS 2005 support:
http://www.datadynamics.com/ShowPost.aspx?PostID=75732

Peter V
ActiveReports Support

Re: PInvoke Error during PDF Export


11-17-2005, 7:08 AM

I just ran into this problem.  It appears that this error is being reported by the MDA (Managed Debugging Assistants).  If I run my application natively, outside the IDE debug environment, it works fine.   There is still a problem, but at least you may be able to get around it by not using debug.

Re: PInvoke Error during PDF Export


11-18-2005, 12:30 PM
In currently released builds of ActiveReports for .NET 2.0 this is a problem due to the Managed Debug Assistants (MDA) - you will only get this error in debug mode currently and you can turn these off to test the code with the pre-release builds of ActiveReports for .NET 2.0 for Visual Studio 2005.  In the final release this has been resolved, and it should be posted in the coming days.
Michael Mason