Debugging data in 'anonymous namespaces' (C++)

This is mentioned in MSDN. It doesn't look like there's a nice solution within the Watch window (you can get the decorated name of your class from a listing I guess).

Your "silly-named namespace" idea would work okay, you could also just declare an identical class with a silly name and cast to that type instead.


Referencing anonymous namespaces in Visual Studio Debugger's expressions is not supported (at least as of VS 2017) and it's really annoying.

From https://docs.microsoft.com/en-us/visualstudio/debugger/expressions-in-the-debugger#c-expressions

Anonymous namespaces are not supported. If you have the following code, you cannot add test to the watch window:

namespace mars
{   
    namespace  
    {  
        int test = 0;   
    }   
}   
int main()   
{   
    // Adding a watch on test does not work.   
    mars::test++;   
    return 0;   
}