Skip to content

Commit 546a8b9

Browse files
committed
Add VS code debugging instructions
1 parent f437d2a commit 546a8b9

File tree

1 file changed

+9
-52
lines changed

1 file changed

+9
-52
lines changed

docs/recipes/developing-and-testing/debug-safe-app.md

Lines changed: 9 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -73,65 +73,22 @@ VS Code allows "full stack" debugging i.e. both the client and server. Prerequis
7373
* [Ionide](https://marketplace.visualstudio.com/items?itemName=Ionide.Ionide-fsharp): Provides F# support to Code.
7474
* [C#](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp): Provides .NET Core debugging support.
7575

76-
#### 1. Create a launch.json file
77-
Open the Command Palette using `Ctrl+Shift+P` and run `Debug: Add Configuration...`. This will ask you to choose a debugger; select `Ionide LaunchSettings`.
76+
#### Debug the Server
7877

79-
This will create a `launch.json` file in the root of your solution and also open it in the editor.
78+
1. Click the debug icon on the left hand side, or hit `ctrl+shift+d` to open the debug pane.
8079

81-
#### 2. Update the Configuration
82-
The only change required is to point it at the Server application, by replacing the `program` line with this:
83-
84-
```json
85-
"program": "${workspaceFolder}/src/Server/bin/Debug/net6.0/Server.dll",
86-
```
87-
88-
#### 3. Configure a build task
89-
* From the Command Palette, choose `Tasks: Configure Task`.
90-
* Select `Create tasks.json file from template`. This will show you a list of pre-configured templates.
91-
* Select `.NET Core`.
92-
* Update the build directory using `"options": {"cwd": "src/Server"},` as shown below:
93-
94-
```json
95-
{
96-
// See https://go.microsoft.com/fwlink/?LinkId=733558
97-
// for the documentation about the tasks.json format
98-
"version": "2.0.0",
99-
"tasks": [
100-
{
101-
"label": "build",
102-
"command": "dotnet",
103-
"type": "shell",
104-
"options": {"cwd": "src/Server"},
105-
"args": [
106-
"build",
107-
"debug-pt3.sln",
108-
// Ask dotnet build to generate full paths for file names.
109-
"/property:GenerateFullPaths=true",
110-
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
111-
"/consoleloggerparameters:NoSummary"
112-
],
113-
"group": "build",
114-
"presentation": {
115-
"reveal": "silent"
116-
},
117-
"problemMatcher": "$msCompile"
118-
}
119-
]
120-
}
121-
```
80+
2. In the bar with the play error, where it says "No Configurations", use the dropdown to select ".NET 5 and .NET Core". In the dialog that pops up, select "Server.Fsproj: Server"
12281

82+
3. Hit F5
12383

124-
#### 4. Debug the Server
125-
Either hit F5 or open the Debugging pane and press the Play button to build and launch the Server with the debugger attached.
126-
Observe that the Debug Console panel will show output from the server. The server is now running and you can set breakpoints and view the callstack etc.
84+
The server is now running. You can use the bar at the top of your screen to pause, restart or kill the debugger
12785

12886
#### 5. Debug the Client
12987

130-
* Start the Client by running `dotnet fable watch -o output -s --run npm run start` from `<repo root>/src/Client/`.
131-
* Open the Command Palette and run `Debug: Open Link`.
132-
* When prompted for a url, type `http://localhost:8080/`. This will launch a browser which is pointed at the URL and connect the debugger to it.
133-
* You can now set breakpoints in the generated `.fs.js` files within VS Code.
134-
* Select the appropriate Debug Console you wish to view.
88+
1. Start the Client by running `dotnet fable watch -o output -s --run npx vite` from `<repo root>/src/Client/`.
89+
2. Open the Command Palettek using `ctrl+shift+p` and run `Debug: Open Link`.
90+
3. When prompted for a url, type `http://localhost:8080/`. This will launch a browser which is pointed at the URL and connect the debugger to it.
91+
4. You can now set breakpoints in by opening files via the "Loaded Scrips" tab in the debugger; setting breakpoints in files opened from disk does NOT work.
13592

13693
> If you find that your breakpoints aren't being hit, try stopping the Client, disconnecting the debugger and re-launching them both.
13794

0 commit comments

Comments
 (0)