[Gtk-sharp-list] PInvokeStackImbalance was detected

Cody Russell bratsche at gnome.org
Mon May 15 20:01:06 EDT 2006


Hi,

I'm relatively new to Mono and C# stuff.  I have been hacking on a GTK app
using Mono on Linux, and right now I am trying to get it to build and run
using VS2005 on Windows.  I am having a little bit of trouble on my expose
event handling for a custom widget, where I have a Gdk.EventExpose arg 'e'
and attempt to access e.Area.X.  VS emits a 'PInvokeStackImbalance was
detected' popup, with the following message:

PInvokeStackImbalance was detected
Message: A call to PInvoke function
'gdk-sharp!Gdk.EventExpose::gtksharp_gdk_event_expose_get_area' 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.

I looked through the sources and found that
gtksharp_gdk_event_expose_get_area does the following:

GdkRectangle
gtksharp_gdk_event_expose_get_area (GdkEventExpose *event)
{
        return event->area;
}

And the C# source for EventExpose does:

public Rectangle Area
{
       get {
             return gtksharp_gdk_event_expose_get_area (Handle);
       }
}

When I looked at the Gdk.Rectangle constructors, I see only one that accepts
(Point, Size) and one that accepts (int, int, int, int).  At a glance, this
looks like a bug to me but since I'm fairly new to C# and also to the Gtk#
bindings, I couldn't immediately say for certain or how to solve it yet.
Can anyone confirm if I'm on the right track with solving my problem?

Thanks,
   Cody
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20060515/cb3ce5d6/attachment.html


More information about the Gtk-sharp-list mailing list