Sunday, February 7, 2016

MonoDevelop - Could not connect to the debugger.



This morning I spent my time to learn C# programming language.. Somehow I pissed with Java which eat to much memory. I use MonoDevelop to train my self. I don't use Microsoft Visual Studio and booting into Windows.. I grab and learn "C# Fundamentals for Absolute Beginners" from MVA (Microsoft Virtual Academy).

But I faced a problem here, seem MonoDevelop are not compatible with Gnome desktop environment. Alternatively, you need to launch it from the Gnome terminal and use xTerm terminal as program out put.

1. Install xTerm terminal first (Skip if you already installed this program)
2. Open Gnome terminal and give this command:
$ unset GNOME_DESKTOP_SESSION_ID 
$ monodevelop

If you hate to give terminal command each time you launch MonoDevelop, you can put unset GNOME_DESKTOP_SESSION_ID inside you MonoDevelop run script.

Let find where you script are located:
$ which monodevelop 
/usr/bin/monodevelop

$ ls -l /usr/bin/ | grep "monodevelop"
-rwxr-xr-x.   1 root root         775 Feb  7 11:19 monodevelop
Then, modify that "monodevelop" file using any text editor with root privilege such gedit. Here my modified script:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
unset GNOME_DESKTOP_SESSION_ID # <-- add this code

#Workaround for Unity gnome shell
export UBUNTU_MENUPROXY=0

# Ubuntu overlay scrollbars are not working well with the 1px boundaries in the monodevelop shell
export LIBOVERLAY_SCROLLBAR=0

# The Oxygen GTK theme crashes unless this is set
export OXYGEN_DISABLE_INNER_SHADOWS_HACK=1

#this script should be in $PREFIX/bin
MONO_EXEC="exec -a monodevelop mono-sgen"
EXE_PATH="${0%%/bin/monodevelop}/lib/monodevelop/bin/MonoDevelop.exe"

_MD_REDIRECT_LOG="${MD_REDIRECT_LOG:-${XDG_CONFIG_HOME:-$HOME/.config}/MonoDevelop/log}"

if [ -n "$_MD_REDIRECT_LOG" ]; then
 mkdir -p `dirname "$_MD_REDIRECT_LOG"`
 $MONO_EXEC $MONO_OPTIONS "$EXE_PATH" $* 2>&1 | tee "$_MD_REDIRECT_LOG"
else
 $MONO_EXEC $MONO_OPTIONS "$EXE_PATH" $*
fi

Now you can use MonoDevelop and do some awesome kung-fu with CSharp..r0x!

1 comment: