godotengine/godot-csharp-vscode

Can't debug at all

TimCoraxAudio opened this issue · 9 comments

First time using the extension and can't get it to work at all after a couple of hours of trying.

Godot runs a basic project with no problem but the extension can't. I have dotnet CLI installed and not mono, though I had mono installed and uninstalled it, nothing changed. I have set the launch.json with the executable path such that if I copy the path string into a shell, Godot runs. Godot has been set to use Visual Studio Code as its external editor under Mono/Editor and builds with dotnet CLI under Mono/Builds

If I try to debug the project using the Launch configuration, a brief window that has no size apart from the top windows bar with minimize, maximize and exit appear. After a few seconds, the window disappears and then nothing else happens, the debugger session doesn't exit but it's not attached to anything. If I try the Play in Editor configuration nothing happens at all

Running on:
VS Code 1.62
Godot 3.4
dotnet 5.0.403
Windows 10
Nvidia GTX 1070

I'm going to assume you are using the latest version of the extension (0.2.0).

The launch.json that is generated, automatically adds a build task to the Launch configuration which opens Godot to build the project (this may be the window you are referring to?).

The Play In Editor configuration requires the Godot editor to be open.

If you haven't used the latest version of the extension to generate the launch.json, could you share that file?


Also, the README.md was recently updated, see if the instructions there are of any help.

  • Yes I'm using 0.2.0
  • I've always got Godot open
    The launch.json was generated by the latest version of the extension, but here's the file:
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Play in Editor",
            "type": "godot-mono",
            "mode": "playInEditor",
            "request": "launch"
        },
        {
            "name": "Launch",
            "type": "godot-mono",
            "request": "launch",
            "mode": "executable",
            "preLaunchTask": "build",
            "executable": "D:\\Godot\\Godot_v3.4-stable_mono_win64\\Godot_v3.4-stable_mono_win64.exe",
            "executableArguments": [
                "--path",
                "${workspaceRoot}"
            ]
        },
        {
            "name": "Launch (Select Scene)",
            "type": "godot-mono",
            "request": "launch",
            "mode": "executable",
            "preLaunchTask": "build",
            "executable": "D:\\Godot\\Godot_v3.4-stable_mono_win64\\Godot_v3.4-stable_mono_win64.exe",
            "executableArguments": [
                "--path",
                "${workspaceRoot}",
                "${command:SelectLaunchScene}"
            ]
        },
        {
            "name": "Attach",
            "type": "godot-mono",
            "request": "attach",
            "address": "localhost",
            "port": 23685
        }
    ]
}

The launch.json seems fine.

When starting a debugging session, a bottom dock should appear in VSCode.
The TERMINAL tab should show the output for the build task, is there any error reported there?
The DEBUG CONSOLE tab shows the output of the debugging session, is there any output there?

I'm having the same issue. I've rolled back to 0.1.3 and debugging works again

I have run into the same problem, and have found this in the log for the GodotDebugSession.log:

05:28:43.261628: GodotDebugSession: Starting debug session...
05:28:43.588631: System.NotSupportedException: The given path's format is not supported.
   at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
   at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
   at System.IO.Directory.CreateDirectory(String path)
   at GodotTools.IdeMessaging.Client..ctor(String identity, String godotProjectDir, IMessageHandler messageHandler, ILogger logger)
   at GodotDebugSession.GodotDebuggerSession.<OnRun>d__3.MoveNext() in /home/ignacio/Projects/vscode/godot-csharp-vscode/GodotDebugSession/GodotDebuggerSession.cs:line 48

I have my project at E:\Projects\Godot\godot-manager-mono. I have also tried moving it to E:\godot-manager-mono, renaming the folder E:\GodotManagerMono, and even moving it to the C drive as well, C:\GodotManagerMono, and all cases, the same error occurs as above, it's throwing a NotSupportedException.

Since you are all using Windows, it seems this issue may be caused by PR #28. That PR implements support for multiple projects in the workspace, to do that it changes the way the project path is retrieved and it seems the path is now using forward slashes (the Unix path separator) and it seems that doesn't work in Windows since it uses a different path separator.

Both the author of that PR and myself use Linux so we missed this, since I don't have a Windows computer I can't test if this is the right fix, but I have opened a PR that may fix this issue: #35.

As mentioned on the PR #35, I can confirm that this patch does correct the issue, and allow projects to once more be launched from VSCode in playInEditor mode with Godot.

That's fantastic that we managed to work it out so quickly. When might we get this hotfix released?

Version 0.2.1 was just published with the fix.