Using Format specifiers while debugging C# in Visual Studio
Imagine you are debugging a .NET application or process and inspecting an object with a formatted debug variable. But you notice it shows the formatted view of the object but you need information from the raw view of the object. So you can track the count / capacity of an Dictionary for example. And scrolling to the very bottom of the watch window just to click the Raw View collapse can be cumbersome especially for objects with really large items.
Using format specifier in Watch windows you can change the format in which a value is displayed in the Watch window in Visual Studio.
In this scenario I’ll be showcasing the raw specifier.
While I was debugging an ASP .NET app the right watch window was showing all the items in the object but I wanted to track the item count. So I specified a the same variable to track in another watch widow with
JsonWebTokenHandler.DefaultInboundClaimTypeMap, raw specified so now it shows the raw view of the dictionary.
Hope this helps all .NET developers in their debugging journeys.
More Information regarding format specifiers can be found: https://learn.microsoft.com/en-us/visualstudio/debugger/format-specifiers-in-csharp?view=vs-2022

