Shell – Why do Mono applications only start from their own directory

gnome-shelllinuxmonopath

If I want to run the application monodevelop, I need to chdir to /usr/lib/monodevelop/Bin and then execute ./MonoDevelop.exe. This is the same for all other Mono applications such as banshee, tomboy, etc.

If I attempt to run the Mono applications from another location by simply running monodevelop, or even from their own directory, I get TypeInitializationExceptions like this:

behrooz@behrooz:/usr/lib/monodevelop/bin$ monodevelop
FATAL ERROR [2012-05-04 11:24:39Z]: MonoDevelop failed to start. Some
of the assemblies required to run MonoDevelop (for example gtk-sharp,
gnome-sharp or gtkhtml-sharp) may not be properly installed in the
GAC. System.TypeInitializationException: An exception was thrown by
the type initializer for Gtk.Application —>
System.EntryPointNotFoundException: glibsharp_g_thread_supported at
(wrapper managed-to-native) GLib.Thread:glibsharp_g_thread_supported
() at GLib.Thread.get_Supported () [0x00000] in :0
at Gtk.Application..cctor () [0x00000] in :0 —
End of inner exception stack trace — at
MonoDevelop.Ide.IdeStartup.Run (MonoDevelop.Ide.MonoDevelopOptions
options) [0x0007e] in
/home/behrooz/Desktop/Monodevelop/monodevelop-2.8.6.5/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:95
at MonoDevelop.Ide.IdeStartup.Main (System.String[] args) [0x0004f] in
/home/behrooz/Desktop/Monodevelop/monodevelop-2.8.6.5/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:503

Why is that?

I have tried reinstalling all Mono, Wine, GTK, Glib, X, Gnome packages.

apt-get --purge --reinstall install $(dpkg --get-selections | grep mono | grep install | grep  -v deinstall | awk'{print $1}')  

I also tried strace on "open" and got nothing by myself.

System Configuration:

  • Debian 6.0-updates 64 bit
  • Kernel 3.2.0-2, 3.2.0-1, 3.1 and 3 EDIT: not a kernel thing
  • Gnome 3.4 EDIT:but a gnome thing
  • Mono 2.10.5
    TLS:           __thread  
    SIGSEGV:       altstack  
    Notifications: epoll  
    Architecture:  amd64  
        Disabled:      none  
        Misc:          softdebug   
        LLVM:          supported, not enabled.  
        GC:            Included Boehm (with typed GC and Parallel Mark)   
    

update: with upgrading to the new MonoDevelop 3.0.2 and latest Mono, I can run MonoDevelop with command monodevelop in terminal, no chdir. but gnome-shell cannot run it.

Finally found it:
as root:

 cd /usr/local/
 find | grep mono|xargs rm -rf
 # Use with caution/some applications may get messed up (stellarium has MONOchrome images...)

Best Answer

It looks like you've built and installed monodevelop from source - did you do the same for the dependencies like gtksharp? Since banshee and tomboy are broken, it sounds like you have a dependency shared between the broken programs, and that's an obvious candidate. Do CLI mono apps work?

From the MonoDevelop build documentation:

We strongly recommend you install everything from packages if possible. If not you, you should use a Parallel Mono Environment. Do not install anything to /usr or /usr/local unless you completely understand the implications of doing do.

If the other mono applications will only run from the installed monodevelop tree, and reinstalling packages hasn't helped, you might have a mess of extra stuff floating around that the source install has added which is interfering with mono finding its libraries, possibly with hardcoded paths into the monodevelop install.

My Debian-fu is not strong, but there should be a way of identifying files in /usr that dpkg doesn't know about, that might be a place to start.

Related Question