Winning the award for the least understandable UI metaphor: the ability to view the environment variables in the target when native debugging.  This is yet another tiny undocumented feature of the native expression evaluator in VS.  $env falls under the same extravagant disclaimer from the @clk post.


Place $env in the watch window and you get … the size in bytes of your environment block. 




Far more useful is to type "$env=0", which evaluates to "0", and dumps all the Environment Variables to the output window.  If you use the Immediate window "?$env=0" you get everything inline.  The feature requires you to be native (or interop) debugging and to evaluate it from a native frame.  


Despite the insane UI interaction, the end result is very useful information.

Comments (2)
  1. Noli San Jose says:

    How come it doesn’t work when I do it in VS2005?

    It says: The name ‘$env’ does not exist in the current context.



Comments are closed.

Skip to main content