C# wait for debugger
Sometimes during debugging part of the startup process, it is difficult to catch it. To make sure the debugger will be attached before some code is executed, you can wait for it:
while (!Debugger.IsAttached)
{
Thread.Sleep(500);
}
Of course, this code is not suitable for production.
- Previous: C# String formatting
- Next: Git Log