Snoop 2.9.0 Release

After a long, long, long, long, long, long, long (ok you get the point) time … Snoop has a release! This release bundles everything in master up … and most notably has a new Triggers tab which you might recognize from Christian Moser’s WPF Inspector utility.


Due to this release … and because GitHub actually does allow you to attach binaries to a release, I will no longer be hosting the binaries here.

Snoop 2.8.0 Download

Unless you are dead or living under a rock, you’ve heard that CodePlex is basically giving up the ghost. I am not sure, but it may be the case that the Snoop 2.8.0 download may not be easily accessible anymore. Given that I’m going to host the Snoop binaries here instead (since GitHub doesn’t allow you to do that) and link from GitHub to here.

Download Snoop here. (The binaries have been removed from this web site, they are now available at GitHub).

Snoop Tips & Tricks #3: The Crosshairs

Ok, I know it has been forever since the last Snoop trick! My apologies! I have a whole list of things that I want to show off … but, man, where do people find the time to do these types of things?! Thinking smile

Often, I have had to choose between working on Snoop … versus documenting what it can do. I have often chosen the former because I think that Snoop is fairly obvious to use … but then I am reminded that I am an expert user of it and that many of its features are really quite hidden. For example, how can you easily select the visuals you want to Snoop on? Why, with the Ctrl-Shift Mouse Over trick, of course. Our first two tricks (Trick 1, Trick 2) covered that particular piece of hidden functionality.

Since those tricks, we have had a couple releases of Snoop (2.7.0 and 2.7.1). We have even converted the CodePlex Snoop repository to Git and also have a sibling repository at GitHub.

So, in this trick, I want to show off a new piece of functionality that we introduced in version 2.7.0 … what I like to call the crosshairs functionality.

This functionality is all about avoiding the combo box of Snoopable applications. It took forever to iterate over all the applications on the system … seeing if each one was a WPF app or not … and filling up the combo box as we go. Why couldn’t we just select that app that we want to Snoop with the cursor? And that is exactly what we did.

Snoop Tips & Tricks #3: The Crosshairs


Now, it is super fast to Snoop an app! You simply launch the Snoop app chooser, drag the crosshairs on top of the app you want to Snoop … and wham bam … you are Snooping.

Thank you Anvaka for implementing this feature!

Happy Snooping!

Snoop Tips & Tricks #2: Snooping Transient Visuals

In this trick, I show you how useful the prior one can really be.

That is, it can be used to Snoop transient visuals … or visuals that aren’t currently in the visual tree. A perfect example of this type of visual … are combo box items.

Snoop Tips & Tricks #2: Snooping Transient Visuals

One thing I forgot to mention in the video … check out the root of the visual tree after I have used the Ctrl-Shift Mouse Over trick on the combo box item … it is not an App object … but a PopupRoot object. This is further indication that Snoop has refreshed the visual tree and placed the transient visual there in place of the normal App object.

Happy Snooping!

Snoop Tips & Tricks #1: Ctrl-Shift Mouse Over

I am always surprised how many people don’t know about this trick … but I guess it isn’t really obvious since I removed the tip from the status bar … in favor of some keyboard functionality.

I thought the best way to show this trick off … is with a screencast. Enjoy!

Snoop Tips & Tricks #1: Ctrl-Shift Mouse Over

Snoop: Now Supports WPF 4.0 Even Better in Snoop v2.6.1

Problems, Problems

The above blog post title is supposed to be kind of a joke. I keep telling people I’m funny. Snoop supposedly has been supporting WPF 4.0 for some time now. Unfortunately, however, there were times where (1, 2) WPF 4.0 applications weren’t showing up in the App Chooser.

In one situation, PresentationFramework.dll wasn’t showing up in the list of loaded modules for the application being Snooped. So, I simply started searching for any of the following assemblies: PresentationFramework.dll, PresentationCore.dll, or wpfgfx_v0400.dll.

But, that didn’t work in all situations.

For sometimes, PresentationFramework.dll shows up as which I believe is the Ngen(ed) version of the assembly. At other times, it isn’t wpfgfx_v0400.dll that shows up in the list of modules, but wpfgfx_v0300.dll. The former is the milcore for WPF 4.0 and the latter is the milcore for WPF 3.5.

At this point, I just searched for the roots of all these names, i.e. PresentationFramework, PresentationCore, and wpfgfx.

But, again … that didn’t work in all situations. Humility, is a virtue … humility is a virtue. Annoyed

For some reason, at times, these modules show up in lower case. Don’t ask me why. If someone can shed light on this, please do. So, I’m now searching for the roots of these assemblies in a case-insensitive way. Granted, I probably should have seen that one coming.

Snoop v2.6.1

Now announcing Snoop v2.6.1!

Snoop v2.6.1 fixes these issues and others. After yet another fellow experienced this problem and since more people are going WPF 4.0 all the time … I figured it was time for a release.

This release also contains some usability improvements from fellow Snoop aficionado, Dan Hanan. In particular:

  1. You can now delve properties by double clicking on the name.
  2. You can now modify the filter sets to contain what you wish to be filtered.
  3. You can now use the mouse wheel to modify property values.
    I also want to say that I have a whole bunch of things lined up for integration into Snoop, but have been struggling to find time. For example, another fellow added the ability to capture some hi-res screen shots from Snoop. So, there is definitely going to be a vNext for Snoop … and hopefully soon.

Snoop Tips & Tricks

For a while now, I’ve been contemplating a blog series on Snoop where I highlight different tips and tricks, and in general, how to use Snoop. And with this release, I’m going to kick it off with the most important one of them all: the Ctrl-Shift Mouse Over trick.

Snoop: Yes, You Can Snoop XBAPs

Today I got a question about whether Snoop supports XBAPs. Actually, this is something I’ve been meaning to look into for a while.

So, I took the two necessary seconds to create a test XBAP project and tried Snooping. It didn’t work. When launching Snoop after running the XBAP, you see PresentationHost.exe in the App Chooser (PresentationHost.exe is the process that the browser launches in the case of an XBAP).


However, trying to Snoop it (clicking the binoculars) … results in … nothing, not even an error.

Now, the person asking … pointed out a Josh Smith’s blog post on the matter … where he discusses three tips for working with XBAPs … one of which is that Snoop doesn’t work, but that Mole does. In order to get Mole to work, however, you must (at least temporarily) make your XBAP a full trust application.

Hmm. That got me thinking. Yes, I know that is dangerous.

A lot of my efforts with Snoop to date … have revolved around getting edge case scenarios to work … and I have modified the start up process significantly. So, I thought, I should quickly check to see if Snoop now works … as long as I change the XBAP to a full trust application.

And … woohoo … it works! Thumbs up

So, all you need to do is go to the Project Properties window, navigate to the Security tab, and check ‘This is a full trust application’.


Hope that helps, and yeah, Snoop rules!


I did also verify (while writing up this post) that neither Snoop 1.0 (Pete Blois’ original version) nor Snoop 2.0 (Pete Blois’ newer stylized version) worked with XBAPs.

.NET Reflector Pro: Debugging the .NET Framework Source Code

The other day, I ran into a situation (see the attached project and here for more info) where I wanted to debug the .NET Framework in order to see how something was working.

Unfortunately, Visual Studio’s native support (see Scott Guthrie’s blog post or Shawn Burke’s blog post) for doing so was failing me. I was eventually able to get that working for .NET 4.0 but not .NET 3.5 SP1 (see this forum thread), but in the meantime … I had to turn to other methods.

So, what is one to do when this happens? Is all lost? Not at all, for you can use .NET Reflector Pro to do the same thing.

.NET Reflector is a very popular .NET utility created by a Microsoft employee, Lutz Roeder. It allows you to explore and analyze .NET managed assemblies. This utility can also be extended by way of add-ins and there is a whole bunch of them out there.

A while ago, Lutz Roeder, decided to let Red Gate take the reins, and they then went ahead and added the ability to allow a user to debug into third-party code and assemblies by way of a Visual Studio add-in.

And that is what I’m going to show you how to do, step-by-step.

Install .NET Reflector Pro

The first thing that you need to do, obviously, is to download and install .NET Reflector, if you haven’t already. There is a download link here.

It comes down as a zip file, so simply extract the contents to a convenient location. Launch it and then select Tools->Integration Options. Here is the dialog that comes up.


This dialog allows you to easily install the .NET Reflector add-in … into Visual Studio. Choose the versions that you want and click OK.


Tell Visual Studio to Disable Optimizations

The next step is very important. If you forget it, you will be frustrated once you get to actually debugging the source code … because all the variables will be optimized away and Visual Studio will also step through the code in odd ways.

So, go to my earlier blog post and follow its instructions. (Also, don’t forget, if you are debugging a Visual Studio 2010 application, to make sure you update the path to devenv.exe … in the .cmd file you create in this step.)

Choose the Assemblies to Debug

Next, launch Visual Studio with the .cmd file from the previous step and load up the project that you want to debug. Go to the .NET Reflector menu and select ‘Choose Assemblies to Debug…’


If you don’t have your options set correctly, the following dialog will come up. Click ‘Turn off “Enable Just My Code”’ to continue.


Now, choose which assemblies that you wish to debug into … via the following dialog.


In my case, I want to debug the ContentPresenter.EnsureTemplate method and the ContentPresenter class lives in PresentationFramework.dll. How do I know this? Well, through .NET Reflector, of course.

Activate .NET Reflector Pro

Once you click OK to the above dialog, you may get prompted with the following dialog.


This, unfortunately, brings up an annoying issue. Even though Red Gate has kindly provided a 14-day trial to use the Pro features of the tool … your trial starts when you install the software and not when try to use the debugging feature for first time.

That is, for me, I was never able to take advantage of the trial period as I had long had the software installed (it is always one of the first pieces of software I put on a newly paved development machine).

So, if you are in this situation, go buy a license and then Activate it here.



Let .NET Reflector Decompile the Assemblies

5. At this point, .NET Reflector Pro is disassembling the assemblies that you have chosen and also reassembling them so that they can generate .pdb files. This process takes quite a bit of time and so they also stuff the output into the ‘Debug Store’ so that you don’t have to do this every time.


If you’ve been around the .NET world for a bit, you’ll notice the similarities in the above step to what you had to do manually in this CodeProject article. And, if you recall, what you ended up debugging … was IL, not C# or VB.

Eventually, everything will succeed.


Verify Your Tools->Options Debugging Settings

At this point, bring up the Tools->Options dialog and go to the Debugging/General tab. Everything should be fine, but as a point of education … and to verify that everything is okay … make sure that all settings pointed to by the red arrows are set as shown.


.NET Reflector cleared the first one (‘Enable Just My Code’) for you … but make sure it is unchecked.

Also, make sure that ‘Enable .NET Framework source stepping’ and ‘Enable source server support’ are unchecked. These options are checked when you are using Visual Studio’s native support to debug into the .NET Framework (mentioned above) … but we don’t want them checked now … so that there is no cause for confusion.

Finally, the ‘Require source files to exactly match the original version’ is not strictly necessary. However, I believe I have had issues in the past if this was checked. If you leave it checked, just keep it in mind, so if things aren’t working you can then try unchecking it.

Next, check out the Debugging/Symbols tab. Below, you can see where .NET Reflector has installed the .pdb files. Make sure those locations are checked … and make sure that everything else in that list is unchecked … especially ‘Microsoft Symbol Servers’

And, very importantly, make sure you have a clean symbol cache … by clicking the ‘Empty Symbol Cache’ button. Why is this important? Well, it ensures that all the .pdb files will be coming fresh from Reflector … and won’t be a stale .pdb from a previous effort at trying to use the native Visual Studio support.

What is the Symbol Cache? Well, the Symbol Cache is where the .pdbs are copied to … so that you don’t have to keep downloading them from the Microsoft Symbol Servers … obviously an important option when using the native Visual Studio support … but not super important when dealing with .NET Reflector. However, I believe Reflector’s .pdb files still get copied to the Symbol Cache.


Debug the .NET Framework (Call Stack Approach)

Now, you need to figure out how to set a breakpoint so that you can break into the application and debug the .NET Framework. The first mechanism is just to set a breakpoint on a local (non-framework) method that you know will cause the class of interest to be on the stack. Then you can double click the stack frame and set another breakpoint as necessary.

For example, let us say that I want to debug System.Windows.Application.DoStartup. I know that the Application class will probably be on the stack if I put a breakpoint in the InitializeComponent method of my MainWindow. So, that’s exactly where I put it.


Now, I click Debug->Start Debugging (F5) and hopefully I will hit my breakpoint. Sure enough:


One thing to note here is that gray text indicates that a .pdb has not been loaded for that assembly while black text indicates that a .pdb has been loaded. That is, in the above example, only PresentationFramework has an loaded .pdb.

And, look! Application.DoStartup is on the stack. Double click that stack frame to bring you to the code.


At this point, you can debug as normal. You can step, watch variables, and more. In the above screen shot, you can see that I set a new breakpoint at the start of the method to be hit when I restart the debugging session. Restarting the application, shows that I can verify that MainWindow.xaml is my StartupUri.


Debug the .NET Framework (Method Breakpoint Approach)

Unfortunately, the above call stack approach to debugging the .NET Framework will only get you so far. Another method I have used in the past is to simply set a breakpoint on a method name. How to do this is not very obvious, though.

The trick is to set a breakpoint via the New->Break at Function menu item in the Breakpoints debugging window.


The New Breakpoint dialog comes up. Simply, and carefully, type the name of the method, prefixed by its Class name, like so:


It will complain, but just click OK.


At this point, just hit F5 (Debugging->Start Debugging) and do what you need to do to hit the breakpoint. And, wa la, here I’ve hit my breakpoint:


The real question that prompted all of this desire to debug the .NET Framework was to see whether the DataContext was getting set or cleared inside of ContentPresenter. And so, I set the following breakpoints and step to my hearts content.



Sometimes, you are up against the wall. You are trying to determine if the .NET Framework has a bug in it … or you’re just trying to get a better grasp about what is really going on in that big black box.

And, while debugging the .NET Framework is best done natively inside of Visual Studio (it’s easier and you can see comments in the source code), it doesn’t always seem to work. Sometimes the assembly you are trying to debug is not supported and at other times the symbol servers don’t seem to be up to date with the released bits.

However, .NET Reflector Pro can come to your rescue in these situations. It can also debug any third-party assembly, regardless of whether it’s Microsoft’s or not.

Good hunting … I hope this helps someone out! Leave a comment if it does!

Snoop: There can be only one!

Haven’t I already said that the community has just been awesome in regards to Snoop?

Well, here is another piece of evidence!

The other day, a developer, Bruno Martinez, from Uruguay contacted me and wanted to contribute to Snoop by making it so that there was only 1 version, instead of the 4 currently required at that point.

If you recall …

  1. You needed a version for WPF 3.5 and 32-bit.
  2. You needed a version for WPF 3.5 and 64-bit.
  3. You needed a version for WPF 4.0 and 32-bit.
  4. You needed a version for WPF 4.0 and 64-bit.

Yuck! Of course, it was better than not being able to Snoop in those situations. 🙂

Well, after integrating Bruno’s changes … you just need:

  1. Snoop


Yeah, that’s right. There are no labels! Thank you, Bruno!

I’m obviously tickled by this … since it was a usability nightmare trying to figure out what version you needed to run … but there are host of other fixes/improvements as well. In particular, the Snoop start-up process is much more robust than it used to be and it can handle some fringe cases that it wasn’t able to before.

Please go to for more info, and of course, the download/release area for version 2.6.0.

Happy Snooping!

Weird Visual Studio 2008 SP1 IntelliSense Issue Figured Out!

Ok, I just have to blog about this, because I just figured out an issue that’s been driving me nuts, nuts, nuts.

In some xaml files, I had no folding editor … and no IntelliSense!

What I discovered was that if I delete the local namespace declaration (and then add it back again), the folding editor starts working again.

Then, I discovered that if I just leave out the local namespace declaration … instead of adding it back, IntelliSense starts working again. Annoying … since I have to remember to put the namespace declaration back before checking it in.

So, I decided to do a search and see if anyone (besides me) had run into this problem. Well, as you all know, the trick to searching for anything on the internet is getting the right search string. Well, I got lucky. This search brought me to this blog post.

It wasn’t exactly my problem, but what I found was that if I added an ‘;assembly=’ to my local namespace declaration … everything started working again … and would continue working even if I closed and reopened the file! Woot! 😀

So, the following xaml doesn’t work:


But, the following xaml DOES work:


Hope this helps someone! It has bothered me for some time!

Just to clarify: this does not affect Visual Studio 2010. That is, you do not need the ‘assembly=’ there … so this was likely an issue with the xaml editor in Visual Studio 2008.