I have written before about high memory usage caused by improper usage of XmlSerializer objects both in a case study and in a debugging lab . The problem there was that every time you create a new XmlSerializer object with a non-default constructor, you generate a new dynamic assembly that contains the definition and methods for the serializer. Since assemblies can’t be unloaded from a process unless the application domain they are loaded in is unloaded memory will keep increasing if you create new XmlSerializer objects until eventually you end up with a System.OutOfMemoryException. In the case of the XmlSerializer dynamic assemblies, they are quite easy to spot as you can look at meta-data (see previous posts) and figure out that...(read more)
It’s been a pretty busy few weeks at work coupled with some vacation so I’ve been lagging a bit with the blogging, so sorry for bombarding the blog with new posts now:) As you all know, Visual Studio 2010 just released and there is a lot of new content out there and I thought I’d mention a few in the debugging/troubleshooting space. ScottGu wrote a post on the VS 2010 debugger improvements as part of his VS 2010 and .NET 4 post series where he talks about news with Data Tips and Breakpoints. The Visual Studio Profiler Team Blog has a lot of posts worth reading about profiling in VS 2010 , including Silverlight Profiling and guidance for profiling. Steve released a new version of SOSex.dll with features that work for both 2.0 and 4.0 John Robbins...(read more)
I was helping out on an issue the other day where the process would stall if they added enough users in their load tests. Btw, serious kudos to them for making load tests, so much nicer to work with a problem in test rather than when it is getting critical on a production machine. We gathered some memory dumps with debug diag of the asp.net process (w3wp.exe) and found that most of the threads were waiting in this type of callstack: NOTE: I have changed a lot of function names and code snippets since it is not relevant for the post. 0:071> !clrstack OS Thread Id: 0x21ac (71) ESP EIP 1c8ceb88 7c8285ec [HelperMethodFrame_1OBJ: 1c8ceb88] System.Threading.ReaderWriterLock...(read more)
If you have ever tried to look at a System.DateTime or System.TimeSpan object in a debugger, you know how difficult it is to see what the value is. For example, this is what a System.DateTime object looks like: 0:017> !do 0x040f59b8 Name: System.DateTime MethodTable: 60809f0c EEClass: 605e1fd8 Size: 16(0x10) bytes GC Generation: 2 (C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll) Fields: MT Field Offset Type VT Attr Value Name 6080ab9c 40000f4 4 System.UInt64 1 instance 633739266270770000 dateData 6082aa5c 40000f0 30 System.Int32[] 0 shared static DaysToMonth365 >> Domain:Value 0097ce58:03d6cad0 << 6082aa5c 40000f1 34 System.Int32[] 0 shared static DaysToMonth366 >> Domain:Value 0097ce58...(read more)
Continuing on from my previous post about DumpAllExceptions , here is another new update that comes with psscor2. When you run !clrstack, you will now see the source and line information for the functions that are displayed. This can be really helpful when trying to track down where a problem is and what path through your code this execution has taken. You don’t have to do anything to make this output display, it will automatically at the end of the line. The output will look something like: 02b9ef98 687db33a MyFile.DoWork(System.Web.HttpContext) c:\MyFile.cs:3710 .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space...(read more)
There have been a few places where you can see this command run, but I wanted to talk about it here officially. This command is used to display all of the exceptions that are currently in the managed heap. One interesting thing is that this function actually looks at what class the object derives from and if it derives from System.Exception, then it will show up in the list. So you can have your own custom exceptions shown here regardless of what naming mechanism you use for your class. There is some helpful information about the output from this command here: ASP.NET Debugging - ASP.NET Tips- DumpAllExceptions , namely that if you run it twice, you may see different callstacks from the various exceptions. Here is the documentation...(read more)
Tom just blogged about a new debugger extension called PSSCor2, which is a superset to the SOS.dll extension that ships with the .net framework. PSSCor2.dll has been around for quite some time at Microsoft, and pretty much everyone debugging .net code with windbg within Microsoft is using this since it contains all the goodness of sos.dll plus a lot of special methods for asp.net and other technologies running on top of the .net framework. The news now is that after a lot of hard work by Tom and Jon Langdon in the CLR team, it is finally released publicly, YAY!!! You can download it here and Tom promised to write some posts about the new commands so you might want to follow that… I will likely do the same later on as well… Just to name...(read more)
I wanted to be the first to inform everyone that there is a major update to the debugger extension story for .NET. Psscor2 has been released! This is a superset of the SOS.dll that ships with the framework. This extension has a lot of advantages over SOS if you are trying to troubleshoot problems, especially if they are caused by ASP.NET. All of the functionality that has been talked about on this blog for the SOS that comes with the debugger is now available for .NET Framework 2.0, 3.0, and 3.5. This one extension will troubleshoot all of those versions. I will be getting into the new commands and talking more about this in the coming weeks. But I wanted to let everyone know and have you all go download the extension...(read more)
Just a quick post to share a link to last years videos for the Oredev developer conference http://oredev.org/video Here is my .net debugging presentation where I show off some windbg + new VS.NET features and apart from all the good developer content, you might also want to check out Scott Hanselmans session on Information Overload and managing the workflow with some tips and tricks on how he manages twitter/facebook/email etc. Thank you to the organizers of Oredev for posting these, Tess Read More......(read more)
Visual Studio.NET 2010 has a new feature that allows you to create nice directed graphs with a markup language called DGML (Directed Graph Markup Language). Visualizing object graphs with DGML Chris Lovett wrote a tool that takes GCRoot output and transforms it to a DGML document so that you can see the roots of an object in a more visual way, and finally Mohamed Mahmoud went one step further and made a debugger extension that does this for you directly. The debugger extension is called VGCRoot and you can get the extension, and some instructions and demos for it here . The VGCRoot extensions If you are looking at a memory dump in windbg and try to figure out why your object is still sticking around, collection after...(read more)
May 5, 2010