Add command-line option to wait for debugger on startup

This commit is contained in:
jvyden 2021-12-10 18:24:33 -05:00
commit 9c9b41ae04
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -1,5 +1,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading;
using Kettu; using Kettu;
using LBPUnion.ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Logging; using LBPUnion.ProjectLighthouse.Logging;
@ -17,6 +18,16 @@ namespace LBPUnion.ProjectLighthouse
{ {
public static void Main(string[] args) 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 // Log startup time
Stopwatch stopwatch = new(); Stopwatch stopwatch = new();
stopwatch.Start(); stopwatch.Start();