Finding the answer to this eased a great pain for me today.

C# allows you to catch an exception like this:

try
{
    if (Installation_State == InstallationState.Installed)
    {
        // Some code that may throw an exception
    }
}
catch (Exception)
{
    Installation_State = InstallationState.Not_Installed;
}

When I’m debugging in Visual Studio, how do I inspect that exception? It does not have a variable name! I knew there had to be an easy way, and a coworker led me to it. In the debugger Watch list, watch the variable $exception.

$exception in the Watchlist

Alternatively, you can mouse over the “catch” to show the little red error icon. Clicking on that will give you the same information.

Catch info