When I started modifying the Space Station 14 code, I encountered an issue: I couldn’t debug the program because there were no ARM dylibs. To help other newbies set up their environment in Visual Studio Code, I’ve outlined the steps below.
Step 1: Install the x64 .NET SDK
dotnet --info
Look for the Target SDK Architecture and the installation path in the output.
Step 2: Update .vscode/launch.json
In your .vscode/launch.json
file, update the program
, args
, and targetArchitecture
arguments for each configuration. Below is a template for the updated configurations:
{
"name": "<launch option name>",
"type": "coreclr",
"request": "launch",
"program": "<path to x64 .NET SDK, default /usr/local/share/dotnet/x64/dotnet>",
"args": ["${workspaceFolder}/bin/Content.<the name>/Content.<the same name>.dll"],
"console": "internalConsole",
"stopAtEntry": false,
"targetArchitecture": "x86_64",
},
Changes
-
Set the
program
argument to the path of the x64 .NET SDK (/usr/local/share/dotnet/x64/dotnet
by default). -
Add the path to the compiled .dll file in the
args
argument. -
Include the
targetArchitecture
argument and set it tox86_64
.
My launch.json configuration
Here’s the launch.json configuration I use for my fork of Space Station 14:
{
// 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": [
// Universal configurations
{
"name": "Client",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/bin/Content.Client/Content.Client.dll",
"args": [],
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Client (Compatibility renderer)",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/bin/Content.Client/Content.Client.dll",
"args": "--cvar display.compat=true",
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": "Server",
"type": "coreclr",
"request": "launch",
"program": "${workspaceFolder}/bin/Content.Server/Content.Server.dll",
"args": [],
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": "YAML Linter",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-yaml-linter",
"program": "${workspaceFolder}/bin/Content.YAMLLinter/Content.YAMLLinter.dll",
"cwd": "${workspaceFolder}/Content.YAMLLinter",
"console": "internalConsole",
"stopAtEntry": false
},
// Arm MacOS x64 configurations
{
"name": "Mac x64 Client",
"type": "coreclr",
"request": "launch",
"program": "/usr/local/share/dotnet/x64/dotnet",
"args": ["${workspaceFolder}/bin/Content.Client/Content.Client.dll"],
"console": "internalConsole",
"stopAtEntry": false,
"targetArchitecture": "x86_64",
},
{
"name": "Mac x64 Client (Compatibility renderer)",
"type": "coreclr",
"request": "launch",
"program": "/usr/local/share/dotnet/x64/dotnet",
"args": [
"--cvar display.compat=true",
"${workspaceFolder}/bin/Content.Client/Content.Client.dll",
],
"console": "internalConsole",
"stopAtEntry": false,
"targetArchitecture": "x86_64",
},
{
"name": "Mac x64 Server",
"type": "coreclr",
"request": "launch",
"program": "/usr/local/share/dotnet/x64/dotnet",
"args": ["${workspaceFolder}/bin/Content.Server/Content.Server.dll"],
"console": "integratedTerminal",
"stopAtEntry": false,
"targetArchitecture": "x86_64",
},
{
"name": "Mac x64 YAML Linter",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build-yaml-linter",
"program": "/usr/local/share/dotnet/x64/dotnet",
"args": ["${workspaceFolder}/bin/Content.YAMLLinter/Content.YAMLLinter.dll"],
"cwd": "${workspaceFolder}/Content.YAMLLinter",
"console": "internalConsole",
"stopAtEntry": false,
"targetArchitecture": "x86_64",
},
],
"compounds": [
{
"name": "Server/Client",
"configurations": [
"Server",
"Client"
],
"preLaunchTask": "build"
},
{
"name": "Mac x64 Server/Client",
"configurations": [
"Mac x64 Client",
"Mac x64 Server",
],
"preLaunchTask": "build",
},
]
}
Notes
-
The configurations include both universal and Mac ARM to x64 specific setups.
-
Before coping check this variant for deprecated configurations.