From 9c9b41ae046b2731c44859eeed32550a0609613e Mon Sep 17 00:00:00 2001 From: jvyden Date: Fri, 10 Dec 2021 18:24:33 -0500 Subject: [PATCH] Add command-line option to wait for debugger on startup --- ProjectLighthouse/Program.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ProjectLighthouse/Program.cs b/ProjectLighthouse/Program.cs index 1ef82df1..9f3a035f 100644 --- a/ProjectLighthouse/Program.cs +++ b/ProjectLighthouse/Program.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics; +using System.Threading; using Kettu; using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Logging; @@ -17,6 +18,16 @@ namespace LBPUnion.ProjectLighthouse { public static void Main(string[] args) { + if (args[0] == "--wait-for-debugger") + { + Console.WriteLine("Waiting for a debugger to be attached..."); + while (!Debugger.IsAttached) + { + Thread.Sleep(100); + } + Console.WriteLine("Debugger attached."); + } + // Log startup time Stopwatch stopwatch = new(); stopwatch.Start();