Catching Exceptions when debugging your c# godot projects using visual studio code & Mono Debug Extension

So the guys over at Godosharp.Net wrote an article on how to setup the mono-debug extension to work with your godot projects. Well currently out of the box exceptions are not caught by default and you may want to catch NullReferenceException‘s when working on your games. So after combing through some source on the plugin I figured out how to do just that.

First you need to open your user settings.

As long as you have the Mono Debug extension installed start typing mono-debug and it should auto complete. If the auto complete doesn’t work you can simply add the following setting block to your user settings file and restart the editor.

Now to test add something like public Random Rand; to your scene script and try to debug. Currently we only have NullRefenceException enabled, but you can choose between never, always and unhandled. In the above settings to catch exceptions.

Happy Debugging!