Commit 1979e51
Fix Windows PowerShell host-start hang in
On recent in-box Windows PowerShell 5.1 servicing builds, the language and
debug servers intermittently hang on startup and ride the CI job timeout
(#2323). The wedge is `SetCorrectExecutionPolicy`: it calls
`Microsoft.PowerShell.Security\Get-ExecutionPolicy -List`, which autoloads
`Microsoft.PowerShell.Security` into the freshly created runspace. That
runspace's `InitialSessionState` is reused from the host runspace and already
carries the module's `ObjectSecurity` type data, so re-binding it throws "The
member `AuditToString` is already present". `PsesInternalHost.Run()` catches
it, faults `_started`, and the pipeline thread exits — but `TryStartAsync` is
still awaiting queued startup tasks that now never run, so it hangs forever.
Configuring the execution policy is best-effort, so we wrap the
`Get-ExecutionPolicy` query in try/catch (mirroring the existing
`Set-ExecutionPolicy` handling just below it) and skip policy configuration
when it fails, rather than letting a type-data hiccup abort host startup. I
also guard the subsequent indexing against a short result list.
With the hang fixed we no longer need the in-box Windows PowerShell E2E skips
added in #2318, so this reverts them: the `SkippableFactOnWindowsPowerShell`
attributes, the `LSPTestsFixture` early-return, and the two attribute files.
The DAP suite passes clean under `powershell.exe`. Three LSP help tests
(`Expand-Archive` synopsis) still fail locally on my older servicing build
(.8655); they pass under `pwsh`, so I'm letting CI judge them on its build
rather than re-skipping. The `ci-test.yml` job timeout from #2318 stays as a
backstop.
Drafted by Copilot (Claude Opus 4.8).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>SetCorrectExecutionPolicy
1 parent 0515a5f commit 1979e51
6 files changed
Lines changed: 76 additions & 187 deletions
File tree
- src/PowerShellEditorServices/Services/PowerShell/Utility
- test/PowerShellEditorServices.Test.E2E
- Hosts
Lines changed: 25 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
145 | 166 | | |
146 | 167 | | |
147 | 168 | | |
| |||
Lines changed: 18 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | 27 | | |
36 | 28 | | |
37 | 29 | | |
| |||
246 | 238 | | |
247 | 239 | | |
248 | 240 | | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
256 | 244 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 245 | + | |
264 | 246 | | |
| 247 | + | |
265 | 248 | | |
266 | 249 | | |
267 | | - | |
| 250 | + | |
268 | 251 | | |
269 | 252 | | |
270 | 253 | | |
| |||
276 | 259 | | |
277 | 260 | | |
278 | 261 | | |
279 | | - | |
| 262 | + | |
280 | 263 | | |
281 | 264 | | |
282 | 265 | | |
| |||
288 | 271 | | |
289 | 272 | | |
290 | 273 | | |
291 | | - | |
| 274 | + | |
292 | 275 | | |
293 | 276 | | |
294 | 277 | | |
| |||
300 | 283 | | |
301 | 284 | | |
302 | 285 | | |
303 | | - | |
| 286 | + | |
304 | 287 | | |
305 | 288 | | |
306 | 289 | | |
| |||
314 | 297 | | |
315 | 298 | | |
316 | 299 | | |
317 | | - | |
| 300 | + | |
318 | 301 | | |
319 | 302 | | |
320 | 303 | | |
| |||
365 | 348 | | |
366 | 349 | | |
367 | 350 | | |
368 | | - | |
| 351 | + | |
369 | 352 | | |
370 | 353 | | |
371 | 354 | | |
| |||
396 | 379 | | |
397 | 380 | | |
398 | 381 | | |
399 | | - | |
| 382 | + | |
400 | 383 | | |
401 | 384 | | |
402 | 385 | | |
| |||
454 | 437 | | |
455 | 438 | | |
456 | 439 | | |
457 | | - | |
| 440 | + | |
458 | 441 | | |
459 | 442 | | |
460 | 443 | | |
| |||
497 | 480 | | |
498 | 481 | | |
499 | 482 | | |
500 | | - | |
| 483 | + | |
501 | 484 | | |
502 | 485 | | |
503 | 486 | | |
| |||
521 | 504 | | |
522 | 505 | | |
523 | 506 | | |
524 | | - | |
| 507 | + | |
525 | 508 | | |
526 | 509 | | |
527 | 510 | | |
| |||
566 | 549 | | |
567 | 550 | | |
568 | 551 | | |
569 | | - | |
| 552 | + | |
570 | 553 | | |
571 | 554 | | |
572 | 555 | | |
| |||
604 | 587 | | |
605 | 588 | | |
606 | 589 | | |
607 | | - | |
| 590 | + | |
608 | 591 | | |
609 | 592 | | |
610 | 593 | | |
| |||
638 | 621 | | |
639 | 622 | | |
640 | 623 | | |
641 | | - | |
642 | | - | |
643 | | - | |
| 624 | + | |
644 | 625 | | |
645 | 626 | | |
646 | 627 | | |
| |||
781 | 762 | | |
782 | 763 | | |
783 | 764 | | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | 765 | | |
789 | 766 | | |
790 | 767 | | |
| |||
Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 1 addition & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | 45 | | |
58 | 46 | | |
59 | 47 | | |
| |||
112 | 100 | | |
113 | 101 | | |
114 | 102 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | 103 | | |
123 | 104 | | |
124 | | - | |
| 105 | + | |
125 | 106 | | |
126 | 107 | | |
127 | 108 | | |
0 commit comments