<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cory Plotts' Blog &#187; Snoop</title>
	<atom:link href="http://www.cplotts.com/tag/snoop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cplotts.com</link>
	<description>Yet another UX guy, working in WPF/Silverlight.</description>
	<lastBuildDate>Fri, 25 Jun 2010 23:59:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Snoop: There can be only one!</title>
		<link>http://www.cplotts.com/2010/06/25/snoop-there-can-be-only-one/</link>
		<comments>http://www.cplotts.com/2010/06/25/snoop-there-can-be-only-one/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 23:57:23 +0000</pubDate>
		<dc:creator>cplotts</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Snoop]]></category>

		<guid isPermaLink="false">http://www.cplotts.com/2010/06/25/snoop-there-can-be-only-one/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>Haven’t I already <a href="http://channel9.msdn.com/posts/Psychlist1972/Pete-at-MIX10-Cory-Plotts-on-Snoop-for-WPF/">said</a> that the community has just been awesome in regards to Snoop?</p>
<p>Well, here is another piece of evidence!</p>
<p>The other day, a developer, <a href="http://www.bigmostacho.com/">Bruno Martinez</a>, 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.</p>
<p>If you recall …</p>
<ol>
<li>You needed a version for WPF 3.5 and 32-bit.</li>
<li>You needed a version for WPF 3.5 and 64-bit.</li>
<li>You needed a version for WPF 4.0 and 32-bit.</li>
<li>You needed a version for WPF 4.0 and 64-bit.</li>
</ol>
<p>Yuck! <em>Of course, it was better than not being able to Snoop in those situations.</em> <img src='http://www.cplotts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Well, after integrating Bruno’s changes … you just need:</p>
<ol>
<li>Snoop</li>
</ol>
<p><a href="http://www.cplotts.com/wp-content/uploads/2010/06/SnoopAppChooserNoLabels.png"><img style="display: inline; border: 0px;" title="SnoopAppChooserNoLabels" src="http://www.cplotts.com/wp-content/uploads/2010/06/SnoopAppChooserNoLabels_thumb.png" border="0" alt="SnoopAppChooserNoLabels" width="521" height="29" /></a></p>
<p>Yeah, that’s right. There are no labels! <strong>Thank you, Bruno!</strong></p>
<p>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.</p>
<p>Please go to <a href="http://snoopwpf.codeplex.com">http://snoopwpf.codeplex.com</a> for more info, and of course, the download/release area for <a href="http://snoopwpf.codeplex.com/releases/view/47822">version 2.6.0.</a></p>
<p>Happy Snooping!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.cplotts.com/2010/06/25/snoop-there-can-be-only-one/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Snoop: Now Supports WPF 4.0</title>
		<link>http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/</link>
		<comments>http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 19:18:59 +0000</pubDate>
		<dc:creator>cplotts</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Snoop]]></category>

		<guid isPermaLink="false">http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/</guid>
		<description><![CDATA[This is just a quick post to point people to the fact that I have updated Snoop on CodePlex (http://snoopwpf.codeplex.com/) such that it now supports WPF 4.0. If you try to Snoop a WPF 4.0 application with the WPF 3.5 version, you will get the following error message: I speculate that this is because there is [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a quick post to point people to the fact that I have updated Snoop on CodePlex (<a title="http://snoopwpf.codeplex.com/" href="http://snoopwpf.codeplex.com/">http://snoopwpf.codeplex.com/</a>) such that it now supports WPF 4.0.</p>
<p>If you try to Snoop a WPF 4.0 application with the WPF 3.5 version, you will get the following error message:</p>
<p><a href="http://www.cplotts.com/wp-content/uploads/2010/02/SnoopError.png"><img style="display: inline; border: 0px;" title="SnoopError" src="http://www.cplotts.com/wp-content/uploads/2010/02/SnoopError_thumb.png" border="0" alt="SnoopError" width="435" height="175" /></a></p>
<p>I speculate that this is because there is a brand new CLR with .NET 4.0 (WPF 4.0) applications. Yes, that’s right, a brand new CLR. We haven’t had one of those for a while.</p>
<p>If someone can confirm this or provide a better understanding of why I can’t Snoop WPF 4.0 applications without retargeting Snoop to .NET 4.0 … please shed some light for me.</p>
<p>So, there are now 4, count them, 4 versions of Snoop:</p>
<ol>
<li>Snoop 32-bit for WPF 3.5</li>
<li>Snoop 64-bit for WPF 3.5</li>
<li>Snoop 32-bit for WPF 4.0</li>
<li>Snoop 64-bit for WPF 4.0</li>
</ol>
<ol>You need to use the right version of Snoop in each particular situation … otherwise … thar will be problems, matey!</ol>
<p>I have also added another label to the app chooser so that you know which version you currently have up. Take a look … this is what it looks like for the 64-bit/WPF 4.0 version:</p>
<p><a href="http://www.cplotts.com/wp-content/uploads/2010/02/image.png"><img style="display: inline; border: 0px;" title="image" src="http://www.cplotts.com/wp-content/uploads/2010/02/image_thumb.png" border="0" alt="image" width="468" height="30" /></a></p>
<p>Let me know if you have any problems by creating a discussion (or participating in a current one) on the <a href="http://snoopwpf.codeplex.com">http://snoopwpf.codeplex.com</a> site.</p>
<p>Enjoy and happy Snooping! <img src='http://www.cplotts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snoop: Now on CodePlex</title>
		<link>http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/</link>
		<comments>http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 18:25:15 +0000</pubDate>
		<dc:creator>cplotts</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Snoop]]></category>

		<guid isPermaLink="false">http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/</guid>
		<description><![CDATA[  Snoop is now on CodePlex at snoopwpf.codeplex.com The community reception to my efforts (blog posts: 1, 2, 3) on Snoop have been wonderful. Some like Anvaka have offered additional feature suggestions; others have just encouraged me. In my last post, a fellow commented asking why it wasn’t up on CodePlex. Well, this was a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cplotts.com/wp-content/uploads/2010/02/CP_banner_111x111_gen.jpg"><img style="display: inline; border: 0px;" title="CP_banner_111x111_gen" src="http://www.cplotts.com/wp-content/uploads/2010/02/CP_banner_111x111_gen_thumb.jpg" border="0" alt="CP_banner_111x111_gen" width="115" height="115" /></a> </p>
<h2>Snoop is now on CodePlex at <a href="http://snoopwpf.codeplex.com">snoopwpf.codeplex.com</a></h2>
<p>The community reception to my <a href="http://www.cplotts.com/2009/12/08/snoop-now-with-64-bit-support-and-more/">efforts</a> (blog posts: <a href="http://www.cplotts.com/2009/04/04/snoop-20-now-works-in-wpf-interop-scenarios/">1</a>, <a href="http://www.cplotts.com/2009/04/13/snoop-now-works-in-wpf-interop-scenarios-part-ii/">2</a>, <a href="http://www.cplotts.com/2009/12/08/snoop-now-with-64-bit-support-and-more/">3</a>) on Snoop have been wonderful. Some like <a href="http://vivalution.blogspot.com/">Anvaka</a> have offered additional feature suggestions; <a href="http://blogs.msdn.com/peterlau/archive/2010/02/10/connected-show-23-addicted-to-spring-net.aspx">others</a> have just encouraged me.</p>
<p>In my last post, a fellow commented asking why it wasn’t up on CodePlex. Well, this was a great suggestion and one that I had actually already considered. That prompted me to email <a href="http://blois.us/blog/">Pete Blois</a> (the original author) for his permission. He graciously gave it and so I then proceeded to put it up there.</p>
<p>It took me a little while, but I now have the initial bits uploaded … that is, the same stuff that is available here at my blog.</p>
<p>Now, there are a <strong>bunch</strong> of things on the todo list. Most notably, <strong>I’ve already modified Snoop so that it works for WPF 4.0</strong> … and definitely want to share that with the world.</p>
<p>So, please be patient, I’ll get to it. Those silly day jobs! <img src='http://www.cplotts.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<h2>Some Info</h2>
<p>If you are going to download the source code and build it, some comments are in order (I’ll put this out at the CodePlex site too).</p>
<p>There are (go to Build-&gt;Configuration Manager) 3 solution platforms (x86, x64, Any CPU) and 2 solution configurations (Debug, Release). The x86 platform is for 32-bit, the x64 platform is obviously for 64-bit, but … what is Any CPU?</p>
<p>Well, Any CPU is only around for Blendability. That is, for some odd reason, I couldn’t bring up the Blend designer Snoop’s window unless it was in this configuration.<strong> I have intentionally marked the ManagedInjector project to not be built under the Any CPU configuration. </strong>Since Any CPU will run as 32-bit on 32-bit operating systems and as 64-bit on 64-bit operating systems, using Any CPU will likely cause a mismatch (and a headache <img src='http://www.cplotts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) with the ManagedInjector dll.  The project which builds the ManagedInjector.dll is a C++ project and there isn’t an Any CPU setting for those (they can only be specifically built to Win32 or x64).</p>
<p>Or, in other words, <strong>make sure you switch into another platform, before you build or the build will fail.</strong></p>
<p>Here’s a chart for quick reference:</p>
<table border="1" cellspacing="0" cellpadding="2" width="595">
<tbody>
<tr>
<td width="96" valign="top"><strong>Platform</strong></td>
<td width="130" valign="top"><strong>Configuration</strong></td>
<td width="368" valign="top"><strong>Notes</strong></td>
</tr>
<tr>
<td width="96" valign="top">x86</td>
<td width="130" valign="top">Debug</td>
<td width="368" valign="top">For 32-bit.</td>
</tr>
<tr>
<td width="96" valign="top">x86</td>
<td width="130" valign="top">Release</td>
<td width="368" valign="top">For 32-bit, builds the installer.</td>
</tr>
<tr>
<td width="96" valign="top">x64</td>
<td width="130" valign="top">Debug</td>
<td width="368" valign="top">For 64-bit.</td>
</tr>
<tr>
<td width="96" valign="top">x64</td>
<td width="130" valign="top">Release</td>
<td width="368" valign="top">For 64-bit, builds the installer.</td>
</tr>
<tr>
<td width="96" valign="top">Any CPU</td>
<td width="130" valign="top">Debug, Release</td>
<td width="368" valign="top"><strong>Only for Blendability. Do not use.</strong></td>
</tr>
</tbody>
</table>
<p> </p>
<h2>Call to Action</h2>
<p>If you have a feature request or want to be involved somehow (maybe as a contributor), please don’t hesitate to <a href="http://www.cplotts.com/contact/">contact</a> me.</p>
<p>For near future though, I’m going to keep the project closed until I can change the copyright info to Ms-PL and clean up the code a bit.</p>
<h2>Thanks</h2>
<p>Finally, I want to publicly thank Pete Blois for first creating this awesome <a href="http://blois.us/Snoop/">tool</a> and for giving us the permission to get it going on CodePlex. A big thanks Pete!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Snoop: Now with 64-bit Support and More</title>
		<link>http://www.cplotts.com/2009/12/08/snoop-now-with-64-bit-support-and-more/</link>
		<comments>http://www.cplotts.com/2009/12/08/snoop-now-with-64-bit-support-and-more/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 18:01:37 +0000</pubDate>
		<dc:creator>cplotts</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Snoop]]></category>

		<guid isPermaLink="false">http://www.cplotts.com/2009/12/08/snoop-now-with-64-bit-support-and-more/</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was rebuilding an application such that it would specifically target the x86 platform … solely because I wanted to Snoop it.</p>
<p>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.”</p>
<p>And that is exactly what I did.</p>
<p>Now … presenting Snoop 32-bit!</p>
<p><a href="http://www.cplotts.com/wp-content/uploads/2009/12/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.cplotts.com/wp-content/uploads/2009/12/image_thumb.png" width="428" height="30" /></a></p>
<p>And Snoop 64-bit!</p>
<p><a href="http://www.cplotts.com/wp-content/uploads/2009/12/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.cplotts.com/wp-content/uploads/2009/12/image_thumb1.png" width="428" height="30" /></a></p>
<p><strike>Here are the binaries for the </strike><strike>32-bit</strike><strike> version and here are the binaries for the </strike><strike>64-bit</strike><strike> version.</strike></p>
<p><em>(The binaries are now (see posts: </em><a href="http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/"><em>1</em></a><em>, </em><a href="http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/"><em>2</em></a><em>) up on </em><a href="http://snoopwpf.codeplex.com/"><em>CodePlex</em></a><em>. Please go download it from there as those binaries will contain the latest and greatest bits.)</em></p>
<p>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.</p>
<p>This was so easy and worked so nicely … that I searched the internet to see if anyone had done this already … and I found <a href="http://team.interknowlogy.com/blogs/danhanan/">Dan Hanan’s</a> nice <a href="http://team.interknowlogy.com/blogs/danhanan/archive/2009/07/15/64-bit-snoop-for-wpf-development.aspx">post</a> on the matter.</p>
<p>The problem, though, was that he did it for original version of Snoop … and not the nicely styled and improved version that <a href="http://blois.us/blog/">Pete Blois</a> currently is making <a href="http://blois.us/Snoop/">available</a> 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. <img src='http://www.cplotts.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  And I, of course, have already fixed the property editing issue in my version (see previous posts: <a href="http://www.cplotts.com/2009/04/04/snoop-20-now-works-in-wpf-interop-scenarios/">1</a>, <a href="http://www.cplotts.com/2009/04/13/snoop-now-works-in-wpf-interop-scenarios-part-ii/">2</a>) with a little help from <a href="http://www.shunra.com/shunrablog/index.php/2009/07/21/a-fix-to-the-awesome-wpf-snoop-utility/">Mark Kharitonov</a> (see this forum <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b99f3db7-540c-43f4-8051-69d2d51a78bc">post</a> for more info on that).</p>
<p>So, I emailed him, got his permission to integrate those changes, and promptly did so. I also added a few improvements myself.</p>
<h2>The Improvements</h2>
<p>Here is what has been improved (over and above Pete Blois’ current version):</p>
<table border="1" cellspacing="0" cellpadding="2" width="595">
<tbody>
<tr>
<td valign="top" width="435"><strong>Improvement</strong></td>
<td valign="top" width="158"><strong>Originator</strong></td>
</tr>
<tr>
<td valign="top" width="435">Handles WPF interop scenarios (both Windows Forms hosting WPF and WPF hosting Windows Forms).</td>
<td valign="top" width="158">Cory Plotts</td>
</tr>
<tr>
<td valign="top" width="435">Fixed the ability to edit properties.</td>
<td valign="top" width="158">Mark Kharitonov</td>
</tr>
<tr>
<td valign="top" width="435">Modified Snoop so that it can handle visual trees that have nesting greater than 255 levels deep.</td>
<td valign="top" width="158">Mark Kharitonov</td>
</tr>
<tr>
<td valign="top" width="435">Modified the project configurations so that you can build a 32-bit version and a 64-bit version. <em>This is what the blog post is all about! Ha!</em></td>
<td valign="top" width="158">Cory Plotts         <br />Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Turned off the showing of properties at their default value (by untoggling the Show Defaults toggle button).</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Turned auto refresh off in the AppChooser. Snoop was previously polling every 20 seconds for new applications.</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Added a checkbox to turn auto refresh back on (if you so desire).</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Added a label to the AppChooser to indicate 32-bit versus 64-bit.</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Added a wait cursor when the AppChooser is busy iterating over the applications to possibly Snoop.</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Added the capability to bring the selected tree view item into view.</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Added the capability to filter properties based on predefined sets of properties.</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Added the ability to pop the target (after a delve) with the back button on the mouse.</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Modified the selected item in the tree view to be a light blue even when it doesn’t have focus.</td>
<td valign="top" width="158">Dan Hanan</td>
</tr>
<tr>
<td valign="top" width="435">Added the ability to pop the target (after a delve) with the alt-left arrow keyboard sequence.</td>
<td valign="top" width="158">Cory Plotts</td>
</tr>
<tr>
<td valign="top" width="435">Added the ability to remember window position, size, and the maximized/minimized/normal state for all three Snoop windows.</td>
<td valign="top" width="158">Cory Plotts</td>
</tr>
<tr>
<td valign="top" width="435">Removed the filtering of ‘devenv’ out from the list of applications that you can Snoop.</td>
<td valign="top" width="158">Cory Plotts</td>
</tr>
<tr>
<td valign="top" width="435"><span style="text-decoration: line-through">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. <em>Don’t know if this an improvement. <img src='http://www.cplotts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></span></td>
<td valign="top" width="158">Cory Plotts</td>
</tr>
<tr>
<td valign="top" width="435">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.</td>
<td valign="top" width="158">Cory Plotts</td>
</tr>
<tr>
<td valign="top" width="435">Integrated <a href="http://vivalution.blogspot.com/">Anvaka</a>’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.</td>
<td valign="top" width="158">Andrei Kashcha (Anvaka)</td>
</tr>
</tbody>
</table>
<p>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.</p>
<p>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 <a href="http://stackoverflow.com/questions/847752/net-wpf-remember-window-size-between-sessions">question</a> and this MSDN <a href="http://msdn.microsoft.com/en-us/library/aa972163.aspx">sample</a> … that is what I did. It seems to work nicely. Let me know if you have any problems with it.</p>
<h2>Snoop(ing) Visual Studio 2010</h2>
<p>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.</p>
<p>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 <a href="http://blogs.msdn.com/ricom/archive/2009/06/10/visual-studio-why-is-there-no-64-bit-version.aspx">post</a> by <a href="http://blogs.msdn.com/ricom/default.aspx">Rico Mariani</a> for more info.</p>
<p>As I have recently been invited into the <a href="http://groups.google.com/group/wpf-disciples?hl=en">WPF Disciples</a> group, I posed the question <a href="http://groups.google.com/group/wpf-disciples/browse_frm/thread/70b94cf0fc67a086?hl=en">there</a>. 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).</p>
<p>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):</p>
<p><a href="http://www.cplotts.com/wp-content/uploads/2009/12/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.cplotts.com/wp-content/uploads/2009/12/image_thumb2.png" width="599" height="484" /></a></p>
<p>And, of course, the Snoop AppChooser:</p>
<p><a href="http://www.cplotts.com/wp-content/uploads/2009/12/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.cplotts.com/wp-content/uploads/2009/12/image_thumb3.png" width="568" height="30" /></a></p>
<p>And, finally, the main Snoop user interface:</p>
<p><a href="http://www.cplotts.com/wp-content/uploads/2009/12/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.cplotts.com/wp-content/uploads/2009/12/image_thumb4.png" width="599" height="484" /></a></p>
<p>I think that is <strong>so cool</strong>. Ok, I know … I need mental help. <img src='http://www.cplotts.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<h2>The Source Code</h2>
<p><strike>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!</strike></p>
<p><strike>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. <em>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.</em></strike></p>
<p><strike>So, here it is: the </strike><strike>source code</strike><strike>.</strike></p>
<p><em>(The source code is now (see posts: </em><a href="http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/"><em>1</em></a><em>, </em><a href="http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/"><em>2</em></a><em>) up on </em><a href="http://snoopwpf.codeplex.com/"><em>CodePlex</em></a><em>. Please go download it from there as that code will contain the latest and greatest bits.)</em></p>
<p>Enjoy!</p>
<p>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.</p>
<h2>An Update</h2>
<p>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.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.cplotts.com/2009/12/08/snoop-now-with-64-bit-support-and-more/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Snoop Now Works in WPF Interop Scenarios, Part II</title>
		<link>http://www.cplotts.com/2009/04/13/snoop-now-works-in-wpf-interop-scenarios-part-ii/</link>
		<comments>http://www.cplotts.com/2009/04/13/snoop-now-works-in-wpf-interop-scenarios-part-ii/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 15:49:59 +0000</pubDate>
		<dc:creator>cplotts</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Snoop]]></category>

		<guid isPermaLink="false">http://www.cplotts.com/?p=149</guid>
		<description><![CDATA[First off, in my previous post, I made the mistake of assuming (given the new look and new functionality) that Pete Blois had bumped the version of Snoop up to 2.0. This does not seem to be the case. So, oops! My apologies! Now, onto the meat of post: I have found a couple more [...]]]></description>
			<content:encoded><![CDATA[<p>First off, in my previous <a href="http://www.cplotts.com/2009/04/04/snoop-20-now-works-in-wpf-interop-scenarios/">post</a>, I made the mistake of assuming (given the new look and new functionality) that <a href="http://blois.us/blog/">Pete Blois</a> had bumped the version of <a href="http://blois.us/Snoop/">Snoop</a> up to 2.0. This does not seem to be the case. So, oops! My apologies!</p>
<p>Now, onto the meat of post: I have found a couple more places where you need to insulate yourself from not having a current Application … and I was able to fix the keyboard issue!</p>
<p>Let’s tackle the keyboard issue first as that is the big one. In the Inspect method of the SnoopUI class, you need to call the static method <strong>ElementHost.EnableModelessKeyboardInterop</strong> and you need to do that when in an interop scenario, that is, when the current Application is null.</p>
<p>The MSDN <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.enablemodelesskeyboardinterop.aspx">documentation</a> for this method states that this method allows a System.Windows.Window to receive keyboard messages correctly when opened modelessly from Windows Forms (our interop scenario). Hmm. Sounds exactly like what I was looking for!</p>
<pre class="brush: c#; highlight: [9,10,11,12,13,14,15,16]">public void Inspect(object target)
{
    this.rootObject = target;
    this.Load(target);
    this.CurrentSelection = this.root;

    this.OnPropertyChanged(&quot;Root&quot;);

    if (Application.Current != null)
    {
        this.Owner = Application.Current.MainWindow;
    }
    else
    {
        ElementHost.EnableModelessKeyboardInterop(this);
    }
    this.Show();
}</pre>
<p>
  <br />This also requires you to add a reference to WindowsFormsIntegration.dll and to add a using statement: </p>
<p></p>
<pre class="brush: c#">using System.Windows.Forms.Integration;</pre>
<p>With the above changes, you should be able to use the keyboard once again to change property values in the property grid that comes up when you Snoop something. Whew! That copy/paste trick was getting old, really fast.</p>
<p>Now, onto the additional places where you need to protect yourself from not having an Application instance. First, the Previewer was broken … and you need to modify the HandleMagnify method of the Previewer class:</p>
<pre class="brush: c#; highlight: [5,6]">private void HandleMagnify(object sender, ExecutedRoutedEventArgs e)
{
    Zoomer zoomer = new Zoomer();
    zoomer.Target = this.Target;
    if (Application.Current != null)
        zoomer.Owner = Application.Current.MainWindow;
    zoomer.Show();
    e.Handled = true;
}</pre>
<p>
  <br />Second, you need to modify the ProcessFilter method of the SnoopUI class so that it uses the Dispatcher for the current thread versus grabbing it off the non-existent Application instance: </p>
<p></p>
<pre class="brush: c#; highlight: [8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]">private void ProcessFilter()
{
    this.filtered.Clear();

    // Blech.
    if (this.filter == &quot;Clear Filter&quot;)
    {
        Dispatcher dispatcher = null;
        if (Application.Current == null)
            dispatcher = Dispatcher.CurrentDispatcher;
        else
            dispatcher = Application.Current.Dispatcher;

        dispatcher.BeginInvoke
        (
            DispatcherPriority.Loaded,
            new DispatcherOperationCallback
            (
                delegate(object arg)
                {
                    this.Filter = string.Empty;
                    return null;
                }
            ),
            null
        );
        return;
    }
    if (this.filter == &quot;Visuals with binding errors&quot;)
        this.FilterBindings(this.root);
    else if (this.filter.Length == 0)
        this.filtered.Add(this.root);
    else
        this.FilterTree(this.root, this.filter.ToLower());
}</pre>
<p>By the way, I would love to hear (by leaving a comment on the blog here), if this helps you at all. I was truly missing the ability to Snoop our WPF interop application myself.</p>
<p>Enjoy!</p>
<p>p.s.</p>
<p><strike> I would love to make my source code modifications to Snoop readily available to the general public, but I have been unable to contact Pete Blois and obtain his permission to do so. Sorry!</strike></p>
<p><em>(The source code and binaries for Snoop are now (see posts: </em><a href="http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/"><em>1</em></a><em>, </em><a href="http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/"><em>2</em></a><em>) up on </em><a href="http://snoopwpf.codeplex.com/"><em>CodePlex</em></a><em>. Please go download it from there as that code will contain the latest and greatest bits.)</em></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.cplotts.com/2009/04/13/snoop-now-works-in-wpf-interop-scenarios-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Snoop Now Works in WPF Interop Scenarios, Part I</title>
		<link>http://www.cplotts.com/2009/04/04/snoop-20-now-works-in-wpf-interop-scenarios/</link>
		<comments>http://www.cplotts.com/2009/04/04/snoop-20-now-works-in-wpf-interop-scenarios/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 22:44:11 +0000</pubDate>
		<dc:creator>cplotts</dc:creator>
				<category><![CDATA[Utilities]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Snoop]]></category>

		<guid isPermaLink="false">http://www.cplotts.com/?p=141</guid>
		<description><![CDATA[Background: Coming from the land of Windows Forms, I have grown addicted to having tools like wfSpy and Hawkeye. A software engineer at the presentation layer needs to have tools like these in order to inspect the objects in a running application and change properties on the fly. Very soon after jumping in head first [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Background:</strong></p>
<p>Coming from the land of Windows Forms, I have grown addicted to having tools like <a href="http://www.codeproject.com/KB/dotnet/wfspy.aspx">wfSpy</a> and <a href="http://www.codeplex.com/hawkeye">Hawkeye</a>. A software engineer at the presentation layer needs to have tools like these in order to inspect the objects in a running application and change properties on the fly.</p>
<p>Very soon after jumping in head first into WPF, I discovered Pete Blois’ utility: <a href="http://blois.us/Snoop/">Snoop</a>. It was definitely what I was looking for. Unfortunately, after playing with it for a while, I learned that it didn’t support our WPF interop scenario. In particular, our application is a Windows Forms application that is hosting WPF content through ElementHost. When you use ElementHost, you don’t have an Application object and Snoop coughs up a hairball because of that.</p>
<p>After that, <a href="http://joshsmithonwpf.wordpress.com/">Josh Smith</a> created <a href="http://www.codeproject.com/KB/WPF/WoodstockForWPF.aspx">Woodstock</a> and <a href="http://karlshifflett.wordpress.com/mole-for-visual-studio/">Mole</a> soon followed. These are both debugger visualizers, and in particular, Mole is extremely nice and powerful. The <a href="http://en.wikipedia.org/wiki/Achilles_tendon">Achilles tendon</a> of debugger visualizers, however, is that you have to be running in the Visual Studio debugger. There are many cases where you can’t or don’t want to do this.</p>
<p>Josh Smith realized this and has created <a href="http://joshsmithonwpf.wordpress.com/cracknet/">Crack.NET</a>. This is a heap walker in the vein of Snoop and Mole … but it can be run outside of the debugger. It is a useful tool in its own right, and of particular note, you can modify the object you’ve ‘cracked’ using IronPython in the tool’s Scriptorium area.</p>
<p>However, even given the above, I was still missing the functionality of good, old wfSpy. Snoop was very close to what I wanted, it just didn’t handle the WPF interop story.</p>
<p>So, after reading this <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b99f3db7-540c-43f4-8051-69d2d51a78bc">post</a> in the WPF forums, I finally broke down, dove into the source code and figured out why. It was rather easy to fix, actually, and here is what I had to do.</p>
<p><strong>&#160;</strong></p>
<p><strong>The Fix:</strong></p>
<p>In the Enqueue method of the DelayedCall class, you need to get hold of the Dispatcher from something other than the Application.Current object. Here is the whole Enqueue method:</p>
<pre class="brush: c#; highlight: [7,8,9,10,11,12,13,14,15,16,17,18]">public void Enqueue()
{
    if (!this.queued)
    {
        this.queued = true;

        Dispatcher dispatcher = null;
        if (Application.Current == null)
            dispatcher = Dispatcher.CurrentDispatcher;
        else
            dispatcher = Application.Current.Dispatcher;

        dispatcher.BeginInvoke
        (
            this.priority,
            new DispatcherOperationCallback(this.Process),
            null
        );
    }
}</pre>
<p>
  <br />In the Inspect method of the SnoopUI class, you once again need to protect yourself from not having an Application object:</p>
<p></p>
<pre class="brush: c#; highlight: [9,10]">public void Inspect(object target)
{
    this.rootObject = target;
    this.Load(target);
    this.CurrentSelection = this.root;

    this.OnPropertyChanged(&quot;Root&quot;);

    if (Application.Current != null)
        this.Owner = Application.Current.MainWindow;
    this.Show();
}</pre>
<p>After those two changes, you can Snoop WPF content hosted in a Windows Forms application through ElementHost. Do I hear a ‘hallelujah’?</p>
<p><strong>On a related note:</strong></p>
<p>One thing I should mention is that property editing is broken in Snoop 2.0. In the WPF forum <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/b99f3db7-540c-43f4-8051-69d2d51a78bc">post</a> mentioned above, Mark points out how to fix this. You just need to add the following line in the correct place in the PropertyInformation constructor:</p>
<pre class="brush: c#">binding.Mode =
	property.IsReadOnly ?
	BindingMode.OneWay :
	BindingMode.TwoWay;</pre>
<p>However, this doesn’t seem to fix it completely when you are running in a WPF interop scenario … because there is still an issue to find and fix. Namely, you can’t use the keyboard to modify the property values. However, I have discovered that you can paste a value in using the clipboard. <strong>If you find out how to fix this, please let me know.</strong></p>
<p><strong>Finally:</strong></p>
<p>Mark also has fixes for a couple other items. One takes care of an issue when the nesting gets too deep and another is a fix for popping the context after you ‘delve’ in on something.</p>
<p>I hope this helps someone. I personally am happy to the point of tears that I will now be able to Snoop our application!</p>
<p><strong>Update:</strong></p>
<p>I have found the keyboard issue and have fixed it. I have also uncovered a couple other changes that you need to make. For example, the Previewer wasn&#8217;t working. See my next blog <a href="http://www.cplotts.com/2009/04/13/snoop-now-works-in-wpf-interop-scenarios-part-ii/">post</a> for details.</p>
<p><strong>Update:</strong></p>
<p><em>(The source code and binaries for Snoop are now (see posts: </em><a href="http://www.cplotts.com/2010/02/11/snoop-now-on-codeplex/"><em>1</em></a><em>, </em><a href="http://www.cplotts.com/2010/02/14/snoop-now-supports-wpf-4-0/"><em>2</em></a><em>) up on </em><a href="http://snoopwpf.codeplex.com/"><em>CodePlex</em></a><em>. Please go download it from there as that code will contain the latest and greatest bits.)</em></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.cplotts.com/2009/04/04/snoop-20-now-works-in-wpf-interop-scenarios/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
