When debugging in Visual Studio (.Net MVC4), is it possible to see all Controller.Session key/values at once? I can view all keys by typing Session
into QuickWatch and expanding "Results View". E.g:
Results View
[0] "IsPlaced"
[1] "FromSLC"
[2] "PersonalId"
[3] "FullName"
Am aware that individual values can be inspected like this but haven't been able to get a list of all keys and values at the same time. Surely this must be possible, either in QuickWatch or the Immediate Window?
I don't see an easy way to do that, your best bet would be to write a method that takes in an HttpSessionState and converts it to a dictionary, and then calling that method from the QuickWatch window. A somewhat more complex solution would be to write your own DebuggerTypeProxy for HttpSessionState and put it in your autoexp.cs file, the advantage of this approach being that it will work across different applications and won't force you dirty up your solution with code that's only of use for debugging.
Idea A You could create a extension Method on the Session Object which prints its content the way you need it. Then call this Method in the immediate Window or add a watch to it.
Idea B You could also create a custom visualizer which displays your Session Object like you intend. There is a basis guide here: http://msdn.microsoft.com/en-us/library/ms164759.aspx
This also means adding code to your project but just like extension methods it will stay at a very defined place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With