- Joined
- Mar 17, 2007
- Messages
- 9,280
This thread is for VSCode impressions and support.
I was able to get debugging to work in VS Code using a very similar configuration to the JetBrains one shared by Quintillus.
First, make sure to install the C# and C# Tools for Godot extensions:
View attachment 623007
Then, you'll want a configuration in `tasks.json` to build the project before running it:
Code:{ "label": "build", "command": "dotnet", "type": "shell", "args": [ "build", // Ask dotnet build to generate full paths for file names. "/property:GenerateFullPaths=true", // Do not generate summary otherwise it leads to duplicate errors in Problems panel "/consoleloggerparameters:NoSummary" ], "group": "build", "presentation": { "reveal": "always" // can change if you don't care to see build output }, "problemMatcher": "$msCompile", "options": { "cwd": "C:/<redacted>/C7/C7" } }
Then add a configuration to launch.json to run the project:
Code:{ "name": "Debug C7", "type": "godot-mono", "request": "launch", "mode": "executable", "preLaunchTask": "build", "executable": "C:/<redacted>/Godot_v3.4.2-stable_mono_win64/Godot_v3.4.2-stable_mono_win64.exe", "executableArguments": [ "--path", "C:/<redacted>/C7/C7" // the path must contain a 'project.godot' file ] }
Set a breakpoint and run that configuration:
View attachment 623008
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "C:/<redacted>/Godot_v3.4.2-stable_mono_win64/Godot_v3.4.2-stable_mono_win64.exe",
"type": "process",
"args": [
"--build-solutions",
"--path",
"${workspaceRoot}/C7",
"--no-window",
"-q"
],
"problemMatcher": "$msCompile"
}
]
}
{
"name": "Launch",
"type": "godot-mono",
"request": "launch",
"mode": "executable",
"preLaunchTask": "build",
"executable": "C:/<redacted>/Godot_v3.4.2-stable_mono_win64/Godot_v3.4.2-stable_mono_win64.exe\r",
// See which arguments are available here:
// https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html
"executableArguments": [
"--path",
"${workspaceRoot}/C7"
]
}
In that post you quoted I generated both files.
The launch.json was generated from the "Run and Debug" menu (like the github repo describes as option 2 in "Setup Debugging").
I don't exactly remember how I set up tasks.json, just that in the post you quoted there was an option for setting up a dotnet build.
The next day, I saw your link to that github repo and decided to try changing my setup to match that. I had some trouble with tasks.json because I had copied my godot exe path wrong, but eventually I got it to work. Now my working configs look like:
tasks.json:
Code:{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "label": "build", "command": "C:/<redacted>/Godot_v3.4.2-stable_mono_win64/Godot_v3.4.2-stable_mono_win64.exe", "type": "process", "args": [ "--build-solutions", "--path", "${workspaceRoot}/C7", "--no-window", "-q" ], "problemMatcher": "$msCompile" } ] }
I tried setting up an alias for Godot studio so I could just reference it as "godot", but I couldn't find a good way to do that. I guess setting up an environment variable and referencing it like %GODOT% might work, but I haven't tried it.
I generated the launch.json file as described in the github repo, the relevant launch config that I was using to debug is:
Code:{ "name": "Launch", "type": "godot-mono", "request": "launch", "mode": "executable", "preLaunchTask": "build", "executable": "C:/<redacted>/Godot_v3.4.2-stable_mono_win64/Godot_v3.4.2-stable_mono_win64.exe\r", // See which arguments are available here: // https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html "executableArguments": [ "--path", "${workspaceRoot}/C7" ] }
In VS Code I'm opening the root folder, which is why those configs reference the program path as "${workspaceRoot}/C7" as opposed to "${workspaceRoot}" like the github repo does.
Looking at the github repo again, I remember doing the first option in the "Setup Debugging" section yesterday to generate the files.
I find the debugging works decently well, although sometimes it will freeze when stepping into functions, I'm guessing because it gets lost trying to dig into assemblies.
I'm not seeing a prompt like that, that happens when you run the debug configuration?
Do you see it happening before or after the build task?
Does it go away once the debugger launches?
What version of Godot studio are you using?
{
"configurations": [
{
"name": "Launch",
...
}
]
}
I needed another layer around the contents of launch.json
{
// 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": [
// configuration JSONs go here
]
}
launch.json:{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceRoot}/C7"
],
"problemMatcher": "$msCompile"
}
]
}
{
// 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": "Launch",
"type": "godot-mono",
"request": "launch",
"mode": "executable",
"preLaunchTask": "build",
"executable": "/home/c7dev/godot/Godot_v3.5-stable_mono_x11_64/Godot_v3.5-stable_mono_x11.64",
// See which arguments are available here:
// https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html
"executableArguments": [
"--path",
"${workspaceRoot}/C7"
]
},
{
"name": "Attach",
"type": "godot-mono",
"request": "attach",
"address": "localhost",
"port": 23685
},
{
"name": "Play in Editor",
"type": "godot-mono",
"mode": "playInEditor",
"request": "launch"
},
{
"name": "Launch (Select Scene)",
"type": "godot-mono",
"request": "launch",
"mode": "executable",
"preLaunchTask": "build",
"executable": "/home/c7dev/godot/Godot_v3.5-stable_mono_x11_64/Godot_v3.5-stable_mono_x11.64",
// See which arguments are available here:
// https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html
"executableArguments": [
"--path",
"${workspaceRoot}/C7",
"${command:SelectLaunchScene}"
]
}
]
}
* Executing task: dotnet build /home/c7dev/workspace/Prototype/C7
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
All projects are up-to-date for restore.
Blast -> /home/c7dev/workspace/Prototype/Blast/bin/Debug/netstandard2.0/Blast.dll
ConvertCiv3Media -> /home/c7dev/workspace/Prototype/ConvertCiv3Media/bin/Debug/net472/ConvertCiv3Media.dll
/usr/lib/dotnet/dotnet6-6.0.108/sdk/6.0.108/Microsoft.Common.CurrentVersion.targets(1802,5): warning NU1702: ProjectReference '/home/c7dev/workspace/Prototype/C7GameData/C7GameData.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v6.0'. This project may not be fully compatible with your project. [/home/c7dev/workspace/Prototype/C7GameDataTests/C7GameDataTests.csproj]
/usr/lib/dotnet/dotnet6-6.0.108/sdk/6.0.108/Microsoft.Common.CurrentVersion.targets(1802,5): warning NU1702: ProjectReference '/home/c7dev/workspace/Prototype/C7Engine/C7Engine.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v6.0'. This project may not be fully compatible with your project. [/home/c7dev/workspace/Prototype/EngineTests/EngineTests.csproj]
/usr/lib/dotnet/dotnet6-6.0.108/sdk/6.0.108/Microsoft.Common.CurrentVersion.targets(1802,5): warning NU1702: ProjectReference '/home/c7dev/workspace/Prototype/C7GameData/C7GameData.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v6.0'. This project may not be fully compatible with your project. [/home/c7dev/workspace/Prototype/EngineTests/EngineTests.csproj]
QueryCiv3 -> /home/c7dev/workspace/Prototype/QueryCiv3/bin/Debug/net472/QueryCiv3.dll
C7GameData -> /home/c7dev/workspace/Prototype/C7GameData/bin/Debug/net472/C7GameData.dll
BuildDevSave -> /home/c7dev/workspace/Prototype/_Console/BuildDevSave/bin/Debug/net472/BuildDevSave.exe
C7Engine -> /home/c7dev/workspace/Prototype/C7Engine/bin/Debug/net472/C7Engine.dll
C7GameDataTests -> /home/c7dev/workspace/Prototype/C7GameDataTests/bin/Debug/net6.0/C7GameDataTests.dll
EngineTests -> /home/c7dev/workspace/Prototype/EngineTests/bin/Debug/net6.0/EngineTests.dll
C7 -> /home/c7dev/workspace/Prototype/C7/.mono/temp/bin/Debug/C7.dll
Build succeeded.
/usr/lib/dotnet/dotnet6-6.0.108/sdk/6.0.108/Microsoft.Common.CurrentVersion.targets(1802,5): warning NU1702: ProjectReference '/home/c7dev/workspace/Prototype/C7GameData/C7GameData.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v6.0'. This project may not be fully compatible with your project. [/home/c7dev/workspace/Prototype/C7GameDataTests/C7GameDataTests.csproj]
/usr/lib/dotnet/dotnet6-6.0.108/sdk/6.0.108/Microsoft.Common.CurrentVersion.targets(1802,5): warning NU1702: ProjectReference '/home/c7dev/workspace/Prototype/C7Engine/C7Engine.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v6.0'. This project may not be fully compatible with your project. [/home/c7dev/workspace/Prototype/EngineTests/EngineTests.csproj]
/usr/lib/dotnet/dotnet6-6.0.108/sdk/6.0.108/Microsoft.Common.CurrentVersion.targets(1802,5): warning NU1702: ProjectReference '/home/c7dev/workspace/Prototype/C7GameData/C7GameData.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v6.0'. This project may not be fully compatible with your project. [/home/c7dev/workspace/Prototype/EngineTests/EngineTests.csproj]
3 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.65
* Terminal will be reused by tasks, press any key to close it.
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "C:\\<path to godot>\\Godot_v3.5-stable_mono_win64.exe",
"type": "process",
"args": [
"--build-solutions",
"--path",
"${workspaceRoot}",
"--no-window",
"-q"
],
"problemMatcher": "$msCompile"
}
]
}
{
// 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": "Launch",
"type": "godot-mono",
"request": "launch",
"mode": "executable",
"preLaunchTask": "build",
"executable": "<path to>\\Godot_v3.5-stable_mono_win64.exe",
// See which arguments are available here:
// https://docs.godotengine.org/en/stable/getting_started/editor/command_line_tutorial.html
"executableArguments": [
"--path",
"${workspaceRoot}\\C7"
]
}
]
}
And then it launches the C7 app.Executing task: <path to>\Godot_v3.5-stable_mono_win64.exe --build-solutions --path <path to>\C7 --no-window -q
messages. They're a bit off-putting but at least the app runs.warning NU1702: ProjectReference '/home/c7dev/workspace/Prototype/C7GameData/C7GameData.csproj' was resolved using '.NETFramework,Version=v4.7.2' instead of the project target framework '.NETCoreApp,Version=v6.0'. This project may not be fully compatible with your project.
Using my tasks and your launch, same behavior as before.DllImport attempting to load: 'Kernel32'. (in domain Mono, info)
DllImport error loading library '/home/c7dev/godot/Godot_v3.5-stable_mono_x11_64/GodotSharp/Mono/lib/mono/4.5/Kernel32': '/home/c7dev/godot/Godot_v3.5-stable_mono_x11_64/GodotSharp/Mono/lib/mono/4.5/Kernel32: cannot open shared object file: No such file or directory'. (in domain Mono, info)
<snip>
DllImport error loading library 'libKernel32': 'libKernel32: cannot open shared object file: No such file or directory'. (in domain Mono, info)
DllImport unable to load library 'Kernel32'. (in domain Mono, warning)
Did you get past this? I can still run with the latest Development and the default map. Do you have any local changes?Although, now after pulling I notice the game doesn't run any more![]()
I just checked again today, pulled down the latest development version, I have no local changes, but it still gets that error. I tried doing some debugging but all I can tell is it's an issue parsing the c7-static-map-save.json file. The debugger in VS code isn't the greatest but I'll see if I can get a better pinpoint on what isn't parsing right.Did you get past this? I can still run with the latest Development and the default map. Do you have any local changes?
Does it work to load Civ3 BIQ or SAV files? Not all of them are supported yet, but SAV files based on lightly modified scenarios (notably ones that leave the default units in-place) should generally work.I just checked again today, pulled down the latest development version, I have no local changes, but it still gets that error. I tried doing some debugging but all I can tell is it's an issue parsing the c7-static-map-save.json file. The debugger in VS code isn't the greatest but I'll see if I can get a better pinpoint on what isn't parsing right.
EDIT: not sure... the debugger isn't the best, it doesn't really match up on the lines in that part of the code and inspecting variables doesn't fully work. I thought it might be a caching issue but I downloaded the file fresh from Github and overwrote it but they were the same file.