0

Although there is a Windows GTK# run-time installer for .NET I have noticed that GTK# applications compiled using MonoDevelop under Linux (built via SlackBuilds so it is pretty fresh) crash on Windows7 if run via double-clicking, whereas if I build the binary using the same project solution using Xamarin Studio for Windows, running via double-clicking is fine. I'm guessing that the MonoDevelop compiled binary does not include stubs needed to use a non-Mono GTK# install.

So: Is it possible to get Linux MonoDevelop to build a GTK# binary that will run with the Windows GTK# .NET runtime on a system without Mono?

Note: Xamarin Studio is on a separate Windows system to the one I am testing the GTK# run-time on, so it is not a case of deployment-testing on a development system..

Remy
  • 329
  • 1
  • 10
  • Your very first thing should be diving into the crash and learn why it crashes, http://blogs.msdn.com/b/lexli/archive/2009/08/23/when-the-application-program-crashes-on-windows.aspx – Lex Li Feb 23 '14 at 02:18
  • The direct cause is an unhandled System.IO.FileNotFoundException, which in turn I believe is caused by an unmet dependency. My suspicion is that Xamarin embeds it.. – Remy Feb 23 '14 at 19:26
  • Can you go one step further to identify which file cannot be found? Either the exception message or Process Monitor should tell more about that. With this piece of information it might be possible to locate the culprit. – Lex Li Feb 25 '14 at 02:01
  • Mono.posix.dll - both binaries are looking for variants such as C:\Windows\assembly\GAC\Mono.Posix\4.0.0.0__0738eb9f132ed756\Mono.Posix.dll, but whereas the Linux-compiled binary gives up, the Xamarin-compiled binary is happily picking up the one at C:\Windows\assembly\GAC_MSIL\Mono.Posix\2.0.0.0__0738eb9f132ed756\Mono.Posix.dll. Looks like the latter has extra code that checks for .NET v2 DLLs as well as the .NET v4 ones, and GTK# .NET installer only installs V2 DLLs.. – Remy Feb 25 '14 at 19:51
  • Your analysis is thorough, so the root cause is very clear at this moment. I think a quick workaround is to ship Mono.Posix (v4) with your binaries. The ultimate fix of course should be a revised GTK# installer, which installs both v2 and v4 of that assembly. – Lex Li Feb 26 '14 at 03:07
  • Looks like Stetic (MonoDevelop's GUI editor) was sticking things like this.labelText = new Gtk.Label(); this.labelText.LabelProp = global::Mono.Unix.Catalog.GetString ("..."); into the code. Guess you can't trust all these fancy GUI editors at all.. – Remy Feb 27 '14 at 19:07

2 Answers2

0

To run your gtk# app compiled in linux with mono, you have to:

  1. Install Visual C++ 2013 x86 redistributable package
  2. Install gtk# for .net
0

To run a gtk# app compiled with monodevelop under Linux on Windows I usually need to disable the "gettext" support in the project options GTK# settings. If this checkmark is on you get the Mono.Posix file open error when you start the program in windows.

adie
  • 1
  • its usually a best practice to highlight more important things in your answer and make it more easy to understand for everyone who reads. :) – Inder Jul 23 '18 at 21:43