Inside and Out…

An attempt to understand technology better…

Archive for the ‘Debugging’ Category

WindowsIdentity Debugger Visualizer for Visual Studio 2005

Posted by Gaurav Khanna on October 9, 2005

I just finished implementing WIVisualizer, a WindowsIdentity debugger visualizer for Visual Studio 2005. It displays important details like:

  • Username
  • Authentication type
  • Impersonation Level
  • Account type – System or Guest
  • Anonymous or Authenticated identity
  • Windows groups the identity is member of

Here’s a screen-shot for the same:

Download from here. To install, simply copy the DLL file to <Visual Studio 2005 Installation Folder>\Common7\Packages\Debugger\Visualizers folder.

Posted in .NET Framework, Debugging, Development, Downloads, Visual Studio | Leave a Comment »

Image Visualizer for VS 2005 Beta 2

Posted by Gaurav Khanna on September 25, 2005

I am currently on the Technology Roadshow across 6 six cities in India, where I am talking about Building performant applications and Debugging Techniques for .NET Framework 2.0.

One of the things the developers here are amazed at are the DataTips that have been introduced with VS 2005, and also with Visualizers. Infact, when I demonstrate the DataSet Visualizer that ships with VS 2005, you can hear the WOW! of the audience 🙂

In the same session, we then go about building a visualizer for the Image class. For those interested, you can download the VS 2005 Beta 2 source code for the same from http://www.wintoolzone.com/showpage.aspx?url=dotnet.aspx.

To activate the visualizer, build the DLL assembly and copy it to <ProgramFiles Folder comes here>\<VisualStudio Installation Folder comes here>\Common7\Packages\Debugger\Visualizers folder

Posted in .NET Framework, Debugging, Development, Downloads, Visual Studio | Leave a Comment »

Enumerating Managed Processes

Posted by Gaurav Khanna on August 16, 2005

System.Diagnostics.Process class is a managed wrap over a subset of the ToolHelp API – as it enumerates only the process list. Not only that, it will list all the running processes, irrespective of whether they are running unmanaged code or running managed code. What if you wish to identify which of these processes are running managed code?

Unfortunately, neither the ToolHelp API, nor the Process class allow us to identify managed processes from the list they provide us. However, if you have noticed while debugging using Visual Studio, the debugger does identify a managed process in such a list:

VS debugger showing processes running managed code

So, how does the VS debugger do it?

Well, the CLR exposes debugging interfaces, which contain this functionality. These interfaces include ICorPublish, ICorPublishProcess, ICorPublishAppDomain, just to name a few. Infact, if you have installed the .NET Framework 2.0 SDK and navigate to the %SDKRoot%\v2.0\include folder, you will see the relevant header files that contain these interface definitions

The same identification can now also be done using managed code. Under %SDKRoot%\v2.0\bin folder, you will find, amongst others, MdbgCore.dll – the core of the managed debugger. If you ILASM this file (yes, its an assembly), you will see the managed wraps of the unmanaged interfaces mentioned above:

Managed wraps of the unmanaged interfaces

The starting point is Microsoft.Samples.Debugging.CorPublish.CorPublish. This lets us enumerate the managed processes, returning an instance of Microsoft.Samples.Debugging.CorPublish.CorPublishProcess type. Below is a sample that exemplifies doing the same:

using
System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Samples.Debugging.MdbgEngine;
using Microsoft.Samples.Debugging.CorPublish; namespace ManagedProcessList
{
    class Program
    {
        static void Main(string[] args)
        {
            CorPublish pub = new CorPublish();
            foreach (CorPublishProcess proc in pub.EnumProcesses())
            {
                Console.WriteLine(“{0} IsManaged: {1}”, proc.DisplayName, proc.IsManaged.ToString());
            }
        }
    }
}

Posted in .NET Framework, Debugging, Tips | Leave a Comment »

System.Data.DataView Debug Visualizer for Visual Studio 2005 Beta 1

Posted by Gaurav Khanna on January 18, 2005

One of the debug visualizers shipped with VS 2005 Beta 1 is the DataSet/DataTable visualizer that allows you to visualize a DataSet and DataTable in a grid. However, it doesn’t let you view a DataView object.

To overcome this, I have written the DataViewVisualizer that allows you to analyze a System.Data.DataView object during debug time and see how it under goes changes when its modified or filters are applied. For instance, when a DataView object is hovered upon by the mouse and the visualizer drop-down clicked, DataViewVisualizer popup comes:

And when its clicked, the visualizer will show you the current view of the DataView object referenced:

And when the view is modified, the visualizer shows the updated details, keeping in mind the modifications and the filter that is applied:

DataView Visualizer is free. Download it from http://www.wintoolzone.com/showpage.aspx?url=dotnet.aspx

Posted in .NET Framework, Debugging, Development, Downloads | Leave a Comment »

WinDBG and PSSCOR

Posted by Gaurav Khanna on January 10, 2005

For those who have worked with WinDBG, Son-of-Strike (SOS) wouldn’t be an unfamiliar territory – the debug extension which allows decently deep managed code debugging. For those who would want to go even deeper than SOS, download PSSCOR, the superset of SOS, from the link below:

http://blogs.msdn.com/mvstanton/archive/2004/04/05/108023.aspx

Once downloaded, .load PSSCOR and issue the !Upgrade command to get the latest version.

Posted in Debugging, Tips | 1 Comment »

WinDBG and PSSCOR

Posted by Gaurav Khanna on January 10, 2005

For those who have worked with WinDBG, Son-of-Strike (SOS) wouldn’t be an unfamiliar territory – the debug extension which allows decently deep managed code debugging. For those who would want to go even deeper than SOS, download PSSCOR, the superset of SOS, from the link below:

http://blogs.msdn.com/mvstanton/archive/2004/04/05/108023.aspx

Once downloaded, .load PSSCOR and issue the !Upgrade command to get the latest version.

Posted in Debugging, Tips | Leave a Comment »