PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.SingleDebuggerBlock Class Reference

Provides a mechanism to make debugging an application a little easier: using the disposable pattern, surround a block of code with the scope for this item's disposal and you'll get: More...

Inheritance diagram for PeanutButter.Utils.SingleDebuggerBlock:

Public Member Functions

 SingleDebuggerBlock (string identifier)
 Constructs the block with the provided identifier.
void Dispose ()

Static Public Member Functions

static IDisposable BlockIfEnvironmentVariableFlagSet (string environmentVariable, string identifier)
 Creates a proper single debugger block when the environment variable with the provided name is set to a truthy value (eg "1", "yes", "true"), otherwise provides a null-disposable which doesn't interrupt flow.
static IDisposable BlockIf (bool flag, string identifier)
 Creates a proper single debugger block when the flag parameter is true, otherwise provides a null-disposable which doesn't interrupt flow.

Detailed Description

Provides a mechanism to make debugging an application a little easier: using the disposable pattern, surround a block of code with the scope for this item's disposal and you'll get:

  1. Execution will wait for a debugger to be attached
  2. The block will be locked for the duration of the scope so that you don't have to deal with contending threads Usage: create a using block around the code you want to debug and ensure you have a breakpoint in that block then start up your application and attach a debugger WARNING: since the code will wait for an attached debugger, you should not leave this unattended

Constructor & Destructor Documentation

◆ SingleDebuggerBlock()

PeanutButter.Utils.SingleDebuggerBlock.SingleDebuggerBlock ( string identifier)

Constructs the block with the provided identifier.

Parameters
identifier

Member Function Documentation

◆ BlockIf()

IDisposable PeanutButter.Utils.SingleDebuggerBlock.BlockIf ( bool flag,
string identifier )
static

Creates a proper single debugger block when the flag parameter is true, otherwise provides a null-disposable which doesn't interrupt flow.

Parameters
flag
identifier
Returns

◆ BlockIfEnvironmentVariableFlagSet()

IDisposable PeanutButter.Utils.SingleDebuggerBlock.BlockIfEnvironmentVariableFlagSet ( string environmentVariable,
string identifier )
static

Creates a proper single debugger block when the environment variable with the provided name is set to a truthy value (eg "1", "yes", "true"), otherwise provides a null-disposable which doesn't interrupt flow.

Parameters
environmentVariable
identifier
Returns

The documentation for this class was generated from the following file:
  • source/Utils/PeanutButter.Utils/SingleDebuggerBlock.cs