Let’s see how you run

It’s always good to be a able to attach a debugger to a program to see how it does its work – animating code makes it far easier to understand that just reading through static source. While trying to get a better understanding of WinRT, I came across the following tool which lets you attach a debugger to a system launched WinRT package from just after it has started up.

If we take a simple WinRT Silverlight application.


As we know, this type of application is compiled into a package. A package is identified using a guid.


It is registered into the registry of the machine.


Using the details about the package, the WinRT tool lets you associate a debugger with it. I downloaded cdb onto my virtual machine, and set that up as the associated debugger.


Launching the application in the Metro interface leads to an instance of cdb.


We can set some breakpoints to see when the Windows Runtime is being initialised.


We see this is happening as the CLR is starting up


We can look at the start up environment of the dll that was generated for the application.



The real start up happens when an instance of the activation factory is created.


Now we have a tool for getting into the code before it runs, we have the ability to do more investigation of what is going on. I hope to blog more about that in the future.

The author of the WinRT tool has some really interesting blog posts on his initial reaction to WinRT: why WinRT, mixing languages, packages, registration and contracts and activation.

This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s