Skip to content

Adds the ability to easily wait for a debugger connection before a .NET Core application executes.

License

Notifications You must be signed in to change notification settings

creyke/WaitForDebugger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WaitForDebugger

Adds the ability to easily wait for a debugger connection before a .NET Core application executes.

Usage

  1. Add a reference to the the WaitForDebugger project (no NuGet currently).

  2. Add the following line to the top of your Program.cs Main() method:

    class Program
    {
        static void Main(string[] args)
        {
            DebuggerAwaiter.Wait(args);
        }
    }
  1. Pass the argument '-waitfordebugger' to your application to have it wait for a local or remote debugger connection before continuing execution.

Alternative Usage

You can also pass a boolean to the Wait() method if you require more granular control over when to wait for the debugger connection:

    class Program
    {
        static void Main(string[] args)
        {
            DebuggerAwaiter.Wait(true);
        }
    }

If you are going full async, you can of course do:

    class Program
    {
        static async Task Main(string[] args)
        {
            await DebuggerAwaiter.WaitAsync(args);
        }
    }

About

Adds the ability to easily wait for a debugger connection before a .NET Core application executes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages