Every once in a while, while debugging multi-threaded applications that do impersonation, it becomes useful to figure out the context that the current thread is running under.  This is especially useful when debugging server scenarios where connections are farmed out to worker threads which begin their work by impersonating the user logging in.  Before Whidbey finding this information wasn't very straightforward, and even when you found out the current user, it was difficult to find out any other security token information.

Thankfully the VS Whidbey debugger team has stepped up with a nice solution to this problem.  You can now evaluate the $user pseudo-register in the debugger, and find out all about the context that the current process and thread are running under.  In addition to the user name, this variable also shows their SID, session id, login id, impersonation level, and active privileges.  In addition to this, information on all the groups that the active user is a member of is listed.

If the current thread is impersonating, then information on the user the thread is impersonating as is also available.  Here's what this might look like on a thread that is not impersonating:

Evaluating the $user pseudo-register in the VS Whidbey QuickWatch window