Run and Debug on Mono

Often, the best way to work through an issue will be to debug the application on the target environment. Debug on Mono brings this functionality to Visual Studio developers by enabling local debugging of Mono applications on Windows or remote debugging on Linux and Mac.


Step 1:

Open your solution in Visual Studio and ensure it compiles.


Debug in Linux - Step 1

Step 2:

Set your breakpoints like you would normally do.


Debug in Linux - Step 2

Step 3:

Select the Mono->Debug in Mono menu item.


Debug in Linux - Step 3

Step 4:

A dialog box will prompt you to choose from Mono profiles you have available for running and debugging Mono applications. If you have not created a profile, you can click the "Create Profile" link to create a new configuration for a local or remote Mono installation.


Alternatively, you can enter server details in the "Quick Launch" section on the right to run against a remote server instance without creating a new configuration.


Debug in Linux - Step 4 - Choose Profile

If you choose to create a new profile, you will have the option to specify the path to a locally installed version of Mono, or you can select "Remote Server" and specify a server name and port for a remote machine running the Mono Tools remote server


In order to find servers on the local subnet when configuring a remote server, UDP is used to broadcast over port 1900 using the multicast address 239.255.255.250. If your server is not appearing, you may want to check your firewall settings.


You can either leave the profile name blank or give it a descriptive name.


Debug in Linux - Step 4 - Create Profile

Step 5:

Your application will be compiled, copied over to Linux, and automatically started. If it is a web application, it will be launched in your default Windows web browser.


Debug in Linux - Step 5

Step 6:

When the application hits the breakpoint, it will stop in Visual Studio, just like normal. From here, you can do the normal debug actions, like examine variables and call stacks.


Debug in Linux - Step 6