Documentation

Debug a Mono application

Debug a Mono application

If you want to debug a Mono application, just create your application as you are used to it, and ensure that you have a MDebug project.

Project configuration

Within your project settings (right click on your project - Properties) you have a new item "MDebug Configuration".

You can decide within this option page if you would like to debug locally or on a remote target.

Local

If you want to debug local, please ensure Mono is installed and within the "MDebug options" the right Mono.exe executable has been found. Afterwards just check the radiobutton "Debug local Mono application". If you like you can pass additional arguments to the "Mono.exe" on execution.
Maybe the used port is already blocked on your system, if you like to, you are able to switch the used port for communicate with the Mono Soft Debugger.

Remote

If you want to debug remote, you will have to give your project the information on which IP-Address the remote target is reachable and which ports have to be used. For this scenario you will have to run the "MDebug Service Application" which communicates between the remote target and Visual Studio.

Service Application
So please ensure that you save the "MDebug Service Application" to your remote target. You will get the correct Version of your Service Application within the MDebug Menu entry.


Just save the executable somewhere, and transfer the executable to your target device (with WinScp for example: https://winscp.net).
On the target please run the application with Mono.

You have to pass the IP-Address which has to be used for listening. So in this example we would have used:
"mono MDebug.DebugHost.exe -a 192.168.0.161"

That would lead to the following output for example:

You have to run this application as long you want to debug with MDebug.
This application will get the binaries and data from Visual Studio and will sync it automatically to the so called "SYNC-Directory".
In this example it is the path "/home/pi/SyncDir".

Within this directory the application will be getting transfered, executed and debugged.

Lookup Target

After the application is up and running on your target, you are able to lookup your target within in Visual Studio.
Therefore in Visual Studio press "Lookup available targets..." and you should see your device:


If you do not see your device please check the "Service Application" is up and running. Maybe a firewall is blocking the UDP communication between the discovery functionality, then you are still able to enter the correct IP-Address and ports manually if you want to try that way.

The applications uses two ports for communication:

  • Mono-Endpoint (Default 14000)
  • Service-Endpoint (Default 10000)

The Mono endpoint is for the mono application and to communicate with the Mono Soft Debugger, the service endpoint is for communicate and control the device within Visual Studio.

Check the connection

Please ensure that the Service-Port and Mono-Port is correctly set accordingly your "MDebug Service Application" which is up and running.