How to debug Xamarin and Mono class library with Visual Studio for Mac

Enabling the debugging of Xamarin or Mono class library in Visual Studio for Mac is really very simple and is well described in this page. The only step you need to do is uncheck the Debug project code only; do not step into framework code. in Visual Studio for Mac > Preferences > Debugger:

Visual Studio for Mac Enable Debug

But…

Even though the above page said Xamarin products ship with the source code for Mono’s class libraries, I was unable to execute the debug after uncheck the above descripted option (the step into options doesn’t work). The reason is simple: no source code is available in your machine!

So, to start debugging, you must download the Mono source code. Simply go to the Mono GitHub page, and select the tag related to your local mono version:

Mono tag selection

then, click on Clone or download > Download ZIP on the right side and unzip the file into the following folder: /Library/Frameworks/Xamarin.iOS.framework/Versions/11.6.1.3/src

Finally, rename the folder in mono:

Mono folder

And voilà:

Mono debug

Found a problem? Edit this post