-
-
Save geoffappleford/88a39491f682bea3531a4254f295fd28 to your computer and use it in GitHub Desktop.
Easy way to debug command-line apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int Main(string[] args) | |
{ | |
#if DEBUG | |
if (args.Any(a => a == "--debug")) | |
{ | |
args = args.Where(a => a != "--debug").ToArray(); | |
Console.WriteLine($"Ready for debugger to attach. Process ID: {Process.GetCurrentProcess().Id}."); | |
Console.WriteLine("Press ENTER to continue."); | |
Console.ReadLine(); | |
} | |
#endif | |
// The rest of the code... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment