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

Published 05 April 08 10:00 by Tom
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# ASP.NET Debugging : ASP.NET Tips: Debugger command you may not know about ??? converttickstodate said on April 5, 2008 1:22 PM:

PingBack from http://blogs.msdn.com/tom/archive/2008/04/05/asp-net-tips-debugger-command-you-may-not-know-about-converttickstodate.aspx

# Josh Coswell said on April 5, 2008 9:20 PM:

That command is new to me at least.

Josh Coswell

http://riverasp.net

# baosheng chao said on April 5, 2008 11:08 PM:

how to study C#.net very good?

# Tom said on April 6, 2008 10:48 AM:

There are a lot of good online references and books for C#.  Here are some books:

http://www.amazon.com/s?ie=UTF8&keywords=C%23&index=books&page=1

# marc said on April 7, 2008 11:02 AM:

These commands don't exist in my sos.dll for .net 2.0. Which version are they in?

thanks

Marc

# Tom said on April 7, 2008 1:46 PM:

Great question Marc.  So these commands are only in the version that comes with the debugger package and are meant for 1.x versions of .NET.

Take care look at http://blogs.msdn.com/tom/archive/2008/03/25/asp-net-and-sos.aspx for more information about moving these to 2.0.

# sandeep said on April 8, 2008 6:30 AM:

hi, iam sandeep . i want to know about asp.net2.0

# Tom said on April 8, 2008 6:41 AM:

What do you want to know about ASP.NET 2.0?  This command?  See my last comment if that is the case.

Just in general?

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

Search

This Blog

Syndication

Page view tracker