Commit 0173ade
committed
Fix for #66, Get-Variable -Scope doesn't always work.
Ideally we should be using CallStackFrame.GetFrameVariables() but it currently seems to be broken. We've been informed that using Get-Variable -Scope <num> isn't great because scope numbers and frames don't always line up. For instance, dot source introducing a new stack frame but not a new scope. But until GetFrameVariables is fixed in a future drop, we have no option but to use Get-Variable -Scope <num>. This will result in stack frames that have no Auto or Local variables. But the good news is that the debug host will no longer crash. :-)
BTW this commit introduces a new optional parameter on PowerShellContext.ExecuteCommand(). While there is a parameter to suppress "output" there was no parameter to suppress "errors" from being written to the debug console. I see no benefit in littering the user's debug console with a bunch of "get-variable : The scope number '#' exceeds the number of active scopes". So there is now a "sendErrorToHost" parameter that defaults to true. However, even when that parameter is set to false, the error info shows up in the DebugAdapter.log file.1 parent 3c5cceb commit 0173ade
File tree
2 files changed
+21
-11
lines changed- src/PowerShellEditorServices
- Debugging
- Session
2 files changed
+21
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | | - | |
364 | | - | |
| 363 | + | |
| 364 | + | |
365 | 365 | | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
| 366 | + | |
371 | 367 | | |
372 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
373 | 376 | | |
374 | 377 | | |
375 | 378 | | |
| |||
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
214 | 217 | | |
215 | 218 | | |
216 | 219 | | |
217 | | - | |
| 220 | + | |
| 221 | + | |
218 | 222 | | |
219 | 223 | | |
220 | 224 | | |
| |||
324 | 328 | | |
325 | 329 | | |
326 | 330 | | |
327 | | - | |
328 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
329 | 336 | | |
330 | 337 | | |
331 | 338 | | |
| |||
0 commit comments