Godot 3 C# Debugging in Visual Studio 2022

Godot Version

Godot 3.5, 3.6

Question

Anyone have some tricks they’d like to share about getting the Visual Studio 2022 Debugger to work with Godot 3 C# projects?

With Godot 4, I’ve had no problem; just use ‘debug->attach to process’.

But with Godot 3.x, yes problem.
When I attach the debugger (debug → attach to process), my breakpoints are not working.
When I inspect using ‘Debug->Window->Modules’ I can see a message showing “Binary not built with debug information”.

This is odd because I absolutely made sure the ‘Export with debug’ checkbox was checked (when attempting to debug exported exe).
I’ve also made sure to add the folders containing the generated .pdb files to my debug symbols location (Tools->Options-Debugging->Symbols) inside visual studio, which didn’t resolve the issue.

I have seen a post from a while ago that debugging worked with Godot 3.3 & VS2019. But with Godot 3.5 & VS2022, not working.

Yes!! :raised_hands:

Hi, I came from Godot 4.2 C# + Visual Studio 2022 (with debug), but I just needed to test a C# project in Godot 3.5.3 Mono for a web export test, and I was having the same issue related to the debugger in Visual Studio 2022. I installed the Godot C# extension for Visual Studio in the hope that I could debug with it, but nothing happened when I tried to debug or attach manually. I researched and tried several approaches in VS 2022 without success. Even enabling the debugger agent (Project Settings > General > Mono > Debugger Agent > Wait for Debugger : ON) and increasing the wait time to 15000 (Project Settings > General > Mono > Debugger Agent > Wait Timeout : 15000).

Then I went to VS Code to see if I could get debugging to work there using the extensions for “C# for Visual Studio Code (Microsoft)”, “C# Tools for Godot (Ignacio Roldán Etcheverry)”, and “Mono Debug (Microsoft)”. And I noticed that after creating the launch.json (in the “Run and Debug” tab) there was this Mono option in the file to attach to the debugger:

Code_g9oPwnEkuo

So to test it, with the Godot editor open, I started the Godot project and in VS Code I ran the “Attach” option and the breakpoint was hit!

Since I never give up trying everything possible, I went back to Visual Studio 2022 and looked for a way to use the same approach and found this extension:

VSMonoDebugger2022

I installed it and in the “Settings…” (Extensions > Settings…) I configured the same port as used by Godot:

Then I started the Godot project, the application went into “waiting” mode, and I selected the option to attach to mono in VS 2022 (Extensions > Attach to mono debugger ) …and voilà! A breakpoint was hit! :fire:

Let me know if it helps you too! :slight_smile:

Kind regards,
Victor

1 Like

Awesome!

That does work :smiley:

Thank you so much!

1 Like

You are welcome! I’m really glad it helped you! :slight_smile:

1 Like

Thank you so much. I tried everything possible, but nothing worked. When I came across your solution and followed your instructions, it worked.

2 Likes

Really glad to hear that @Dimentrrr! :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.