I'm trying to debug a running ASP.NET app with WinDbg. What I need is to see the value of an argument passed to a method. So I'm on a breakpoint in this method, and from !clrstack -p
i get this:
PARAMETERS:
this (0x00000004af4fdc10) = 0x000001a2b8a06e68
ideaForum (0x00000004af4fdc18) = 0x000001a2b8b11bc8
page (0x00000004af4fdc20) = 0x0000000300000001
I'm interested in the "page" argument which is of type int?
(System.Nullable<System.Int32>
) so first I find the MT address for System.Nullable`1[[System.Int32, mscorlib]]
which happens to be 00007ffa263c7ae0. Then I call !dumpvc 00007ffa263c7ae0 0000000300000001
and here is what I get:
Name: System.Nullable`1[[System.Int32, mscorlib]]
MethodTable: 00007ffa263c7ae0
EEClass: 00007ffa25dc6580
Size: 24(0x18) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll
Fields:
MT Field Offset Type VT Attr Value Name
00007ffa263da2e0 4000707 0 System.Boolean 1 instance hasValue
00007ffa263baf60 4000708 4 System.Int32 1 instance value
As you can see, I'm doing what was marked as answer in Windbg with SOS, How to dump a c# struct but it doesn't display values for fields which is what I need. What else do I need to do to get to the values? Thanks.
EDIT: It appears I was using the wrong address for the argument after all. The one in parens after the argument name is the correct one, so I should have used 0x00000004af4fdc20
. With this, !dumpvc does work as expected. Sosex is easier to use because it just needs the argument name to do the job
Use !sosex.mk -a
. Use !mdt
for dumping types, if what you are after is field values. Sosex tends to be more friendly at displaying field values, whereas sos excels in displaying the more technical details of layout. Disclosure: I am the author of sosex, but it is completely free.