"... and no one shall work for money, and no one shall work for fame; But each for the joy of the working, and each, in his separate star, shall draw the thing as he sees it, for the god of things as they are"



Implementing Visual Studio Remote Debugging On the Beaglebone Black


This page describes how to remotely compile and debug C# executables running on the Beaglebone Black from a remote Windows 10 PC using the Visual Studio 2017 IDE. This page is part of a series of web pages which describe how to install C# and Mono on the Beaglebone Black and also how to configure a useful remote compilation and debugging toolchain for it.

Visual Studio has no "native" ability to perform remote debugging on anything, let alone a Mono installation running on a Debian Linux Beaglebone Black. Visual Studio is very adapable though and a free, open source, "soft debugger" called MonoRemoteDebugger is available for it. In order to use the MonoRemoteDebugger software you need to install it into Visual Studio and also download and run a debugging server on the Beaglebone Black.

The MonoRemoteDebugger Installation on Visual Studio

The MonoRemoteDebugger is designed to provide full debugging capabilities on remote .NET executables. It will also transport the compiled binaries and the necessary debugging files over (.pdb &etc) to the Beaglebone Black. This means you do not have to set up any complicated transport mechanism to get your compiled code over to the BBB. All you need to do is edit your software on the Windows PC, compile it, and when time comes to run it, use a simple menu command to set it running (and debugging) on the Beaglebone Black.

To install the MonoRemoteDebugger software in Visual Studio use the following steps.

1) Open Visual Studio 2017

The documentation states that the MonoRemoteDebugger tool will also work in Visual Studio 2015 - but all of the screenshots below are taken in the Community Edition of Visual Studio 2017 using a Windows 10 O/S.

2) Choose the Extensions and Updates Option from the Tools menu

Look under the Tools menu and choose the Extensions and Updates Option.


3) Choose the MonoRemoteDebugger Tool

When the Extensions and Updates form pops up, choose the "Online" option in the column at left. There are a lot of tools on offer so you can save yourself time by searching for "Mono" in the box in the upper right hand corner. Find the MonoRemoteDebugger Tool and select it with the mouse. You will see a button entitled "Download" next to the Tool. In the image below there is a green checkbox which indicates that the tool is already installed - you will see a "Download" button if the software is not present. Press the "Download" button to install MonoRemoteDebugger.


4) Close Visual Studio

The installation launches in a separate process. You may need to close Visual Studio before the installation can proceed. You will see it waiting.

5) The MonoRemoteDebugger Menu

Start Visual Studio again once the installation has completed and you should see that a new MonoRemoteDebugger menu is visible.


Those are all of the installation steps you need to perform on the PC side - the remainder of the actions take place on the Beaglebone Black.

The MonoRemoteDebugger Server Installation on the Beaglebone Black

The MonoRemoteDebugger component on the Beaglebone Black is a server. The installation is simple...

1) Download the MonoRemoteDebugger Server

The command below will download the MonoRemoteDebugger Server. All of the installation steps below were performed on a Beaglebone Black running Debian GNU/Linux 9 (Stretch). The account is just a normal user account and, although it has the ability to sudo to root, that functionality is not used.
wget https://github.com/techl/MonoRemoteDebugger/releases/download/v1.3.0/MonoRemoteDebugger.Server.zip

2) UnZip the MonoRemoteDebugger Server Download

The command below will unzip the newly downloaded MonoRemoteDebugger Server.
unzip -d MonoRemoteDebugger.Server MonoRemoteDebugger.Server.zip

2) Run MonoRemoteDebugger.Server exe

Run the Run MonoRemoteDebugger.Server.exe file in the account in which you unzipped it. The server does not need root access or anything like that. The server will open up a port and wait listening for the Visual Studio Debugger to contact it.
    cd MonoRemoteDebugger.Server
    mono MonoRemoteDebugger.Server.exe

Those are all of the installation steps you need to perform on the Beaglebone Black. The next action is to test the installation.

Create a Test Project on the Development PC

In order to prove that remote debugging is operational, we will need something to debug. Create a test Console application project in Visual Studio called HelloWorldTest.

namespace HelloWorldTest
	class MainClass
		public static void Main (string[] args)
			Console.WriteLine ("Hello World 1");
			Console.WriteLine ("Hello World 2");
			Console.WriteLine ("Hello World 3");

We have three "Hello World" lines because we are going to set a breakpoint on one and step through the remotely executing code.

Choose the Debug with Mono (Remote) Option

The screenshot below shows the above code in Visual Studio with a breakpoint set and the Debug with Mono (Remote) option being selected from the main MonoRemoteDebugger menu.


Fill in the Data on the MonoRemoteDebugger Form

When the Debug with Mono (Remote) option is chosen, the MonoRemoteDebugger Form will appear. You need to fill in the IP address of the Linux box as shown below. The other defaults are fine and do not need to be changed unless you changed them on the server. When you have done this press the "Connect" button. The form will remember the settings, so in the future you only have to press the button.


Observe the Execution on the Server

After you press the "Connect" button, the executable and associated debug information will be transported to your Beaglebone Black and will begin to execute in the account which is running the MonoRemoteDebugger.Server. You can see the output appear on the screen as shown below. Note that the execution has stopped after the first statement because it has run into the breakpoint.


Observe the Debug Session in Visual Studio

The Visual Studio IDE will also show that the execution has stopped at the appropriate break point.


Inside the Visual Studio IDE you can take all the debug actions with the remotely executing program that you can do locally. The only exception, it seems, is that you cannot set breakpoints in user created threads. Perhaps a future release will offer this functionality.

The Location of the Files on the Server

As mentioned previously, the debug process uploads the binaries and debug files to the server. You can see these files in the Temp directory just below the MonoRemoteDebugger.Server.exe file itself. The items with the long names (in blue) in the image below are directories and they will contain the binaries and the associated debugging files.



At this point you have now reached the final page in the series of web pages describing how to install Mono on the Beaglebone Black. Hopefully they have provided you with some useful advice and that you are now able to create a C# program on the Beaglebone Black and also remotely compile and debug C# executables on that platform using a nice tool chain. I wish you well - good luck.


The contents of this web page are provided "as is" without any warranty of any kind and without any claim to accuracy. Please be aware that the information provided may be out-of-date, incomplete, erroneous or simply unsuitable for your purposes. Any use you make of the information is entirely at your discretion and any consequences of that use are entirely your responsibility. All source code is provided under the terms of the MIT License.