How to see exception detail in debugger without assigning variable to exception?

c#, exception, visual-studio

Solution

You can see your exception in Locals list or use `$exception` in Watch list:

try
{
    // some code
}
catch (SecurityException)
{ // place breakpoint at this line
}

Problem

I want to see exception detail in visual studio debugger without assigning variable to exception. Currently I have to write something like this: ``` try { //some code } catch (SecurityException ex) { //some code or ever no any code } ``` Visual studio throws an error indicating that ex variable is never used, but i need this variable to see exception detail while debugging. UPDATE: I know how to suppress VS error 'variable is never used', problem is in seeing exception inside watch without this variable. $exception variable by @VladimirFrolov or exception helper by @MarcGravell is an answer.

Original source