Skip to content

Commit 06fba72

Browse files
authored
Merge pull request #425 from PowerShell/rkeithhill/debugger-break
How about popping UI to attach the debugger?
2 parents 7331273 + 9155a8f commit 06fba72

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/PowerShellEditorServices.Host/EditorServicesHost.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,16 @@ public EditorServicesHost(
7373
this.featureFlags = new HashSet<string>(featureFlags ?? new string[0]);
7474

7575
#if DEBUG
76-
int waitsRemaining = 10;
7776
if (waitForDebugger)
7877
{
79-
while (waitsRemaining > 0 && !Debugger.IsAttached)
78+
if (Debugger.IsAttached)
8079
{
81-
Thread.Sleep(1000);
82-
waitsRemaining--;
80+
Debugger.Break();
8381
}
82+
else
83+
{
84+
Debugger.Launch();
85+
}
8486
}
8587
#endif
8688

0 commit comments

Comments
 (0)