-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix tests in Debugging/DebugServiceTests.cs
and simplify faulty script path logic
#1540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The restored test code looks good, but there seem to be some product changes that aren't explained or mentioned in the title or description. I've read through the commit descriptions, but I think it's worth adding an explanation of the changes and how they relate to the testing in the PR description for posterity.
src/PowerShellEditorServices/Services/PowerShellContext/PowerShellContextService.cs
Outdated
Show resolved
Hide resolved
|
f2f2d46
to
4470f49
Compare
The `scriptPath` (which amusingly could also be a script block) is used as a key in a hashtable of breakpoints in the debug service. To avoid a (that specifically showed up in the unit tests), we validate that a non-empty (and non-null) value is provided.
Some extant code was using PowerShell to get the current working directory and then was hardcoded to prepend that to the given path, in order to make an "absolute path." This was buggy, so we fixed it by only prefixing non-rooted paths with the CWD, and do so with `Path.Combine`.
This primarily occured during unit testing, where the language server is not instantiated. Note that elsewhere in this file it is treated similarly.
With the default value of `true` for `shouldWaitForExit` this would deadlock because it exepcted the pipeline execution thread to clean it up...except it was waiting in the pipeline execution thread.
4470f49
to
10acadc
Compare
The only posterity that exists is Git commits. PRs disappear. We might not be on GitHub in five years (we weren't hardly more than five years ago!) |
Ok, well seeing as how it's just a copy and paste and others on the team tend to look at the PRs, I'll do it for you |
Debugging/DebugServiceTests.cs
Debugging/DebugServiceTests.cs
and simplify faulty script path logic
@andschwa looks like you're still pushing commits, let me know when you want a review |
Dah they DO literally all pass locally now. Ugh checking CI. Apparently differences between |
A number of items needed to be fixed: * `Path.Combine` instead of `Path.Join` because of .NET changes * `ConfigureAwait(false)` because of our rule to always include that * Pass actual script path to `BreakpointDetails.Create` so the debug service has a valid value for its hashtable key * Call `Close()` instead of `Dispose()` (which changed) on `PowerShellContextService` * Make assertion in `AssertDebuggerStopped` case-insensitive * Increase cancellation token source timeouts to 10 seconds * Avoid waiting for PowerShell context state change that never happens and isn't required * Delete unused fields or local variables * Avoid issue with breakpoint ordering (see comment) * Consistently abort the debugger and wait for the `executeTask` * Make `Get-Process` test cross-platform (and execute the right line)
10acadc
to
648cd3e
Compare
Also we just went from 1,543 in CI to 1,829 🥳 |
This resolves #1442, and sets me up to add a test around debugging code that uses an object from
System.Windows.Forms
.This PR also: