Bug 4526 - Incorrect p/invoke in gtk when run on windows
Summary: Incorrect p/invoke in gtk when run on windows
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: Trunk
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Alan McGovern
URL:
Depends on:
Blocks:
 
Reported: 2012-04-19 13:28 UTC by Alan McGovern
Modified: 2012-10-04 07:56 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Alan McGovern 2012-04-19 13:28:58 UTC
I'm just running monodevleop under the visual studio debugger and it gave me this warning:

A call to PInvoke function 'Mono.TextEditor!Mono.TextEditor.GtkWorkarounds::gtksharp_container_override_forall' 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.
Comment 1 Mikayla Hutchinson [MSFT] 2012-04-23 08:23:35 UTC
Fixed in master.
Comment 2 Alan McGovern 2012-04-23 12:27:42 UTC
I think there are a few more places where this can happen on windows. Does every p/invoke in main\src\addins\MonoDevelop.GtkCore\libstetic\ParamSpec.cs need to be marked with cdecl too? I still get this when running under visual studio:

A call to PInvoke function 'libstetic!Stetic.ParamSpec::g_type_class_ref' has unbalanced the stack

After searching the code for "[DllImport" strings, there are a few places where we p/invoke gobject/glib/gtk/pango/cairo without specifying Cdecl as the calling convention. There are also some places where we do specify that. Are all of these libraries cdecl on windows?
Comment 3 Alan McGovern 2012-04-26 11:46:37 UTC
Should I mark all p/invokes to gobject/gtk/glib etc with cdecl? I assume so, but i'd like confirmation before doing it.
Comment 4 Mikayla Hutchinson [MSFT] 2012-04-26 12:04:03 UTC
Dunno. I assume so too, but maybe you should check.
Comment 5 Alan McGovern 2012-04-26 12:05:04 UTC
How do i check?
Comment 6 Mikayla Hutchinson [MSFT] 2012-04-26 12:08:31 UTC
Dunno. If you can't find any other way, maybe use the debugger helper you used to find the first one?
Comment 7 Alan McGovern 2012-05-01 06:16:23 UTC
I fixed some more of these as indicated by the VS debugger helper. There are probably more though. I'll leave this bug open for now until i've verified every p/invoke.
Comment 8 Alan McGovern 2012-10-04 07:56:32 UTC
Fixed in ui-refresh.