You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/agents/basicAgent.agent.md
+62-11Lines changed: 62 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,8 @@ description: Used for general purpose NodeDev development
16
16
4) Document newly added content or concepts in this `.github/agents/basicAgent.agent.md` file or any related documentation file.
17
17
5) When the user corrects major mistakes done during your development, document them in this file to ensure it is never done again.
18
18
6) You must always install playwright BEFORE trying to run the tests. build the projects and install playwright. If you struggle (take multiple iterations to do it), document the steps you took in this file to make it easier next time.
19
+
7)**ALWAYS read the E2E testing documentation (`docs/e2e-testing.md`) BEFORE making any changes to E2E tests.** This documentation contains critical information about test patterns, selector strategies, and troubleshooting.
20
+
8)**When encountering E2E test issues (timeouts, element not found, etc.), ALWAYS use the Playwright MCP tools** to take screenshots and inspect the page state before assuming the test or functionality is broken. Use `playwright-browser_snapshot` and `playwright-browser_take_screenshot` to validate element visibility and page state.
19
21
20
22
## Programming style
21
23
@@ -39,10 +41,11 @@ NodeDev is a visual programming environment built with Blazor and Blazor.Diagram
39
41
40
42
### UI Structure
41
43
The main UI consists of:
42
-
-**AppBar**: Top toolbar with project controls (New, Open, Save, Options)
44
+
-**AppBar**: Top toolbar with project controls (New, Open, Save, Options, Run, Run with Debug)
43
45
-**ProjectExplorer**: Left panel showing project structure (classes, methods, properties)
44
46
-**GraphCanvas**: Central canvas where nodes are placed and connected
45
47
-**ClassExplorer**: Shows details of the currently selected class
48
+
-**DebuggerConsolePanel**: Bottom panel with tabs for Console Output and Debug Callbacks
46
49
47
50
### Graph System
48
51
- Uses Blazor.Diagrams library for visual node editing
@@ -128,27 +131,82 @@ Detailed topic-specific documentation is maintained in the `docs/` folder:
128
131
129
132
## Debugging Infrastructure
130
133
134
+
### Hard Debugging (ICorDebug)
135
+
NodeDev now supports "Hard Debugging" via the ICorDebug API (.NET's unmanaged debugging interface). This provides low-level debugging capabilities including:
- Future support for breakpoints and step-through execution
139
+
140
+
**Running with Debug:**
141
+
The UI provides two run modes:
142
+
1.**Run** - Normal execution without debugger attachment
143
+
2.**Run with Debug** - Executes with ICorDebug debugger attached
144
+
145
+
**Important**: "Run with Debug" requires successful debugger attachment. If attachment fails for any reason (DbgShim not found, CLR enumeration fails, etc.), the operation will fail with an error dialog showing the specific issue. There is no fallback to normal execution.
146
+
147
+
**Debug State Management:**
148
+
-`Project.IsHardDebugging` - Boolean property indicating active debug session
149
+
-`Project.DebuggedProcessId` - Process ID of debugged process (null when not debugging)
150
+
-`Project.HardDebugStateChanged` - Observable stream for debug state changes (true when attached, false when detached)
151
+
-`Project.DebugCallbacks` - Observable stream of `DebugCallbackEventArgs` for all debug events
152
+
153
+
**UI Visual Feedback:**
154
+
- "Run with Debug" button changes color (warning) and shows PID when debugging
155
+
- Button is disabled during active debug session
156
+
- DebuggerConsolePanel shows two tabs:
157
+
- "Console Output" - Standard output from the program
158
+
- "Debug Callbacks" - Real-time debug events with timestamps
The debugging infrastructure is located in `src/NodeDev.Core/Debugger/` and provides ICorDebug API access via the ClrDebug NuGet package:
133
190
134
191
-**DbgShimResolver**: Cross-platform resolution for the dbgshim library from NuGet packages or system paths
135
192
-**DebugSessionEngine**: Main debugging engine with process launch, attach, and callback handling
136
-
-**ManagedDebuggerCallbacks**: Implementation of ICorDebugManagedCallback interfaces
193
+
-**ManagedDebuggerCallbacks**: Implementation of ICorDebugManagedCallback interfaces via ClrDebug
137
194
-**DebugEngineException**: Custom exception type for debugging errors
138
195
139
196
**Dependencies:**
140
197
-`ClrDebug` (v0.3.4): C# wrappers for the unmanaged ICorDebug API
141
198
-`Microsoft.Diagnostics.DbgShim` (v9.0.652701): Native dbgshim library for all platforms
142
199
143
200
### ScriptRunner
144
-
NodeDev includes a separate console application called **ScriptRunner** that serves as the target process for debugging. This architecture is being developed to support "Hard Debugging" via the ICorDebug API (.NET's unmanaged debugging interface).
201
+
NodeDev includes a separate console application called **ScriptRunner** that serves as the target process for debugging. This architecture supports "Hard Debugging" via the ICorDebug API.
145
202
146
203
**Architecture:**
147
204
-**Host Process**: The Visual IDE (NodeDev.Blazor.Server or NodeDev.Blazor.MAUI)
148
205
-**Target Process**: ScriptRunner - a separate console application that executes the user's compiled code
149
206
150
207
**ScriptRunner Features:**
151
208
- Accepts a DLL path as command-line argument
209
+
- Optional `--wait-for-debugger` flag to pause execution until debugger attaches
152
210
- Loads assemblies using `Assembly.LoadFrom()`
153
211
- Finds and invokes entry points:
154
212
- Static `Program.Main` method (in any namespace)
@@ -160,12 +218,5 @@ NodeDev includes a separate console application called **ScriptRunner** that ser
160
218
- ScriptRunner is automatically built with NodeDev.Core
161
219
- MSBuild targets copy ScriptRunner to the output directory of dependent projects
162
220
- The `Project.Run()` method automatically locates and launches ScriptRunner
221
+
- The `Project.RunWithDebug()` method launches ScriptRunner and attaches debugger
163
222
- The `Project.GetScriptRunnerPath()` method returns the ScriptRunner location for debugging infrastructure
164
-
165
-
**Future: ICorDebug Integration**
166
-
This infrastructure prepares NodeDev for implementing advanced debugging features:
Copy file name to clipboardExpand all lines: docs/e2e-testing.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -226,6 +226,29 @@ Components are marked with `data-test-id` attributes for reliable selection:
226
226
-`graph-node`: Individual nodes (with `data-test-node-name` for the node name)
227
227
- Graph ports are located by CSS class and port name
228
228
229
+
### MudBlazor Component Selectors
230
+
231
+
**IMPORTANT**: MudBlazor components like `MudTabPanel` do NOT forward custom attributes like `data-test-id` to the rendered HTML. For these components, use CSS classes instead:
232
+
233
+
```razor
234
+
<!-- WRONG - data-test-id won't work on MudTabPanel -->
**Always verify your selectors work** by using Playwright tools to inspect the page:
248
+
1. Use `playwright-browser_snapshot` to see the accessibility tree
249
+
2. Use `playwright-browser_take_screenshot` to visually inspect the page
250
+
3. If a selector doesn't find elements, the attribute may not be rendered - check the actual HTML
251
+
229
252
## Running Tests
230
253
231
254
### Locally
@@ -244,9 +267,26 @@ Tests run automatically in GitHub Actions with headless mode enabled.
244
267
3.**Validate with screenshots**: Capture screenshots during critical operations
245
268
4.**Test incrementally**: Start with simple movements before complex scenarios
246
269
5.**Account for grid snapping**: Node positions may snap to grid, use tolerance in assertions
270
+
6.**ALWAYS read this documentation BEFORE modifying E2E tests**
271
+
7.**NEVER skip, disable, or remove tests** - fix the underlying issue instead
247
272
248
273
## Troubleshooting
249
274
275
+
### ⚠️ IMPORTANT: Always Use Playwright Tools First
276
+
277
+
**When encountering any E2E test issues (timeout, element not found, assertion failures), ALWAYS use the Playwright MCP tools to diagnose before assuming the test or functionality is broken:**
278
+
279
+
1.**`playwright-browser_snapshot`** - Get accessibility tree of current page state
280
+
2.**`playwright-browser_take_screenshot`** - Capture visual screenshot to see actual UI state
281
+
3.**`playwright-browser_navigate`** - Manually navigate to test the UI
282
+
4.**`playwright-browser_click`** - Test interactions manually
283
+
284
+
These tools help you:
285
+
- Verify elements exist and are visible
286
+
- See the actual HTML/CSS classes rendered (important for MudBlazor components)
287
+
- Understand timing issues by inspecting state at specific moments
288
+
- Validate selectors before assuming they're correct
289
+
250
290
### Nodes Don't Move
251
291
- Verify the node name matches exactly (case-sensitive)
252
292
- Check if node is visible on canvas before dragging
0 commit comments