Introducing Rodney Viana’s WinDbg Extension for .NET Debugging
When a .NET application fails in production the developer is often left with just a memory dump. Since Visual Studio cannot handle dumps, you have to instead look at a tool called WinDbg. This is often used with SOS.dll or Psscor4.dll, which are extensions that expose .NET specific details. Though powerful, these can be difficult to use so developers occasionally create their own extensions. Once such developer is Rodney Viana, who has just released netext 1.6.1 as an open source project.
An interesting feature of netext is the ability to query the heap using a SQL-like syntax. For example, say you wanted to see a list of recent web requests that failed. Since the HttpContext objects are cached you can look for failed queries using this syntax:
!wfrom -type *.HttpContext |
where ( ($contains(_request._url.m_String, "http:")) && (_response._statuscode != 0n200) )
select $addr(), _request._url.m_String, _response._statusCode
Here is a list of the supported commands:
Commands to Show Object Details
- !wdo - Display ad-hoc objects or arrays from GAC or Stack
- !wselect - Display ad-hoc fields (and level fields) for an object or for all item in an array
- !wfrom - Perform SQL-like analysis of Heap objects enabling comparison, expression evaluation and indexed filtering.
- !windex - index and display objects based in different filters like object with of type HttpContext
- !wstack - dump unique stack objects
- !wheap - list objects without indexing and show thottled heap sampling
- !wgchandles - Dump GC root handles
- !wdict - Display dictionary objects
- !whash - Display HashTable objects
- !whttp - List HttpContext Objects
- !wconfig - Show all .config file lines in memory
- !wservice - List WCF service Objects
- !weval - Evaluate expression list
- !wclass - Show "reflected" class definition (fields, properties and methods)
Netext also supports functions for working with aggregation, strings, XML, arrays, and reflection.
Netext is offered under the GNU General Public License version 2. Though Rodney Viana is a Microsoft employee, this considered to be a personal project and is not supported by Microsoft.
Shane Hastie Aug 30, 2014
Roy Rapoport Aug 28, 2014