Freigeben über


ASP.NET Tips: Debugger command you may not know about – converttickstodate

Here is another command that can really help to figure out what is happening.  If you have spent much time looking at managed dumps, you have probably come across the problem of trying to look at a System.DateTime or System.TimeSpan object.  For example, here is some output from !dumpobj:

timeout

From this, we can see that we have some kind of time object.  Since I know those class, I know it is a System.TimeSpan object.  So finding the MethodTable for that class from !dumpheap -stat, I can then print out the object using !dumpvc:

timeout2

Now this isn’t all that helpful, we see that the ticks are set to 900000000, but what kind of TimeSpan is that?  This is where this command comes into play.  We can pass the ticks to that command ( !ctd for short) and we will see:

timeout3

It prints out both TimeSpan and DateTime values, so if you aren’t sure which one it is, you can figure it out from the output.  Here we can see the timeout is set to 1:30 or 90 seconds.

Because we deal with ValueType object for these so often, there is another command !convertvtdatetodate ( !cvtdd) that can take the original object and print it out:

timeout4

kick it on DotNetKicks.com

Comments