diff --git a/src/PowerShellEditorServices.Host/Program.cs b/src/PowerShellEditorServices.Host/Program.cs index efa4062c2..95b146c6d 100644 --- a/src/PowerShellEditorServices.Host/Program.cs +++ b/src/PowerShellEditorServices.Host/Program.cs @@ -27,15 +27,15 @@ static void Main(string[] args) "/waitForDebugger", StringComparison.InvariantCultureIgnoreCase)); - // Should we wait for the debugger before starting? if (waitForDebugger) { - // Wait for 25 seconds and then continue - int waitCountdown = 25; - while (!Debugger.IsAttached && waitCountdown > 0) + if (Debugger.IsAttached) { - Thread.Sleep(1000); - waitCountdown--; + Debugger.Break(); + } + else + { + Debugger.Launch(); } } #endif