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:
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:
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:
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:
Comments
Anonymous
April 05, 2008
PingBack from http://blogs.msdn.com/tom/archive/2008/04/05/asp-net-tips-debugger-command-you-may-not-know-about-converttickstodate.aspxAnonymous
April 05, 2008
That command is new to me at least. Josh Coswell http://riverasp.netAnonymous
April 05, 2008
how to study C#.net very good?Anonymous
April 06, 2008
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=1Anonymous
April 07, 2008
These commands don't exist in my sos.dll for .net 2.0. Which version are they in? thanks MarcAnonymous
April 07, 2008
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.Anonymous
April 07, 2008
hi, iam sandeep . i want to know about asp.net2.0Anonymous
April 07, 2008
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?