The other day I was rebuilding an application such that it would specifically target the x86 platform … solely because I wanted to Snoop it.
I’ve done this many, many times because it is the only way I’ve been able to Snoop applications on my Windows 7 64-bit operating system. And, I thought, “Boy, this is stupid. I should be able to build a 64-bit version of Snoop such that I don’t have to do this anymore.”
And that is exactly what I did.
Now … presenting Snoop 32-bit!
And Snoop 64-bit!
Here are the binaries for the 32-bit version and here are the binaries for the 64-bit version.
It was rather a simple matter really. I just needed to change all the project configurations so that they targeted the x64 platform … for the x64 version of Snoop … and all the project configurations so that they targeted the x86 platform … for the x86 version of Snoop.
The problem, though, was that he did it for original version of Snoop … and not the nicely styled and improved version that Pete Blois currently is making available since property editing was originally (still?) broken in that version. However, he also had several nice usability features that I was drooling over and wanted for my very own. 😀 And I, of course, have already fixed the property editing issue in my version (see previous posts: 1, 2) with a little help from Mark Kharitonov (see this forum post for more info on that).
So, I emailed him, got his permission to integrate those changes, and promptly did so. I also added a few improvements myself.
Here is what has been improved (over and above Pete Blois’ current version):
|Handles WPF interop scenarios (both Windows Forms hosting WPF and WPF hosting Windows Forms).||Cory Plotts|
|Fixed the ability to edit properties.||Mark Kharitonov|
|Modified Snoop so that it can handle visual trees that have nesting greater than 255 levels deep.||Mark Kharitonov|
|Modified the project configurations so that you can build a 32-bit version and a 64-bit version. This is what the blog post is all about! Ha!||Cory Plotts
|Turned off the showing of properties at their default value (by untoggling the Show Defaults toggle button).||Dan Hanan|
|Turned auto refresh off in the AppChooser. Snoop was previously polling every 20 seconds for new applications.||Dan Hanan|
|Added a checkbox to turn auto refresh back on (if you so desire).||Dan Hanan|
|Added a label to the AppChooser to indicate 32-bit versus 64-bit.||Dan Hanan|
|Added a wait cursor when the AppChooser is busy iterating over the applications to possibly Snoop.||Dan Hanan|
|Added the capability to bring the selected tree view item into view.||Dan Hanan|
|Added the capability to filter properties based on predefined sets of properties.||Dan Hanan|
|Added the ability to pop the target (after a delve) with the back button on the mouse.||Dan Hanan|
|Modified the selected item in the tree view to be a light blue even when it doesn’t have focus.||Dan Hanan|
|Added the ability to pop the target (after a delve) with the alt-left arrow keyboard sequence.||Cory Plotts|
|Added the ability to remember window position, size, and the maximized/minimized/normal state for all three Snoop windows.||Cory Plotts|
|Removed the filtering of ‘devenv’ out from the list of applications that you can Snoop.||Cory Plotts|
|Modified the project configurations so that it never builds the installer. I just copy the Snoop executable and the ManagedInjector dll from place to place. Don’t know if this an improvement. 🙂||Cory Plotts|
|Fixed the x86 installer and created an installer for x64. Snoop is no longer being added to the GAC and the assemblies are thus no longer strong named. The installers for both platforms should now work.||Cory Plotts|
|Integrated Anvaka’s great suggestion below (see the comments). That is, I moved the long label that tells a user how to ctrl-shift click on the application being Snoop(ed) (to a tool tip on the tree view) … and replaced it with a label that tells the user what the immediate following hyperlink is … that is, the Keyboard.FocusedElement. Also added another label and hyperlink for the current selection’s focus scope.||Andrei Kashcha (Anvaka)|
I chose not to integrate a couple of Dan Hanan’s changes. First, I did not integrate the ‘indexer delve’. Well, actually I did, but then noticed that Pete Blois’ new version already allowed you to delve into items in a collection … and so I backed it out.
Second, I did not integrate the ‘use 2nd monitor if present’ feature. I liked that feature but thought that I would try to improve upon it by remembering the position and size of all the windows … regardless of the number of monitors. So, with a little help from this StackOverflow question and this MSDN sample … that is what I did. It seems to work nicely. Let me know if you have any problems with it.
Snoop(ing) Visual Studio 2010
Finally, ever since I’ve installed Visual Studio 2010, I’ve wanted to take a peek under the covers with Snoop (remember … Microsoft used WPF in this latest version of Visual Studio). I originally thought I couldn’t Snoop it … because it was running as a 64-bit application and I only had a 32-bit version of Snoop.
So, when I got the 64-bit version of Snoop going, I quickly tried Snooping Visual Studio 2010. No luck! Bringing up task manager, I quickly remembered that Visual Studio runs as a 32-bit application on 64-bit operating systems. See this post by Rico Mariani for more info.
As I have recently been invited into the WPF Disciples group, I posed the question there. Imagine my surprise to find out that devenv.exe was manually being filtered out (since Visual Studio 2008 would load WPF assemblies … but Snoop would fail since Visual Studio 2008 wasn’t built with WPF).
That gave me quite the chuckle. Or, more like, duh! So, promptly removed that and Snoop(ed) Visual Studio 2010 to my delight (check out the red Snoop adorner):
And, of course, the Snoop AppChooser:
And, finally, the main Snoop user interface:
I think that is so cool. Ok, I know … I need mental help. 😀
The Source Code
In the past, I have not released the source code since I have wanted to get Pete’s permission before I do so. I actually met him at PDC 2009 this year. I brought up the fact that I had modified Snoop to handle interop scenarios … but I forgot to ask him about the source code! There are so many changes now … that I think it would be counter-productive to not release it … in case someone else wants to take Snoop even further than I (and Dan and Mark) have. If you do modify it … and take it further … please let me know! I would love the chance to determine whether to integrate the changes into this version. So, here it is: the source code .
p.s. If you were one of the few who pulled down the binaries immediately after I posted it, then you may not have gotten the Snoop.exe.config file. Unfortunately, in this case, Snoop does not seem to close down all the way (i.e. I had to manually kill it through task manager). You’ll want to get the latest binaries that do include the Snoop.exe.config file … or manually rebuild them yourself with the source code.
See above (in the table of improvements), but I fixed the installers and integrated a nice idea by Anvaka. All the attached binaries (which should be installers now) and source code have been updated.