<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Peter Ritchie's MVP Blog : Product Bugs</title><link>http://msmvps.com/blogs/peterritchie/archive/tags/Product+Bugs/default.aspx</link><description>Tags: Product Bugs</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Drag-copying in Visual Studio Solution Explorer.</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/07/18/drag-copying-in-visual-studio-solution-explorer.aspx</link><pubDate>Fri, 18 Jul 2008 16:46:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1640926</guid><dc:creator>PeterRitchie</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/peterritchie/rsscomments.aspx?PostID=1640926</wfw:commentRss><comments>http://msmvps.com/blogs/peterritchie/archive/2008/07/18/drag-copying-in-visual-studio-solution-explorer.aspx#comments</comments><description>&lt;p&gt;NOTE: I&amp;#39;ve tried this in Visual Studio 2008 (VS2k8), I&amp;#39;m assuming the same thing happens in Visual Studio 2005 (VS2k5).&lt;/p&gt;
&lt;p&gt;In the process of refactoring, it&amp;#39;s *very* common for me to rename a type.&amp;nbsp; This is most easily done by renaming the file in the Solution Explorer (SE)--which renames the file, the type, and and any uses of the type in the entire solution.&lt;/p&gt;
&lt;p&gt;Occasionally, I need to create a new type based on another.&amp;nbsp; Copying an abstract type in order to implement the abstract type is often handy--I just fill in the abstract members (and delete &amp;quot;abstract&amp;quot;) in the copied type after renaming it.&lt;/p&gt;
&lt;p&gt;Drag-copy in the SE seems like it would take care of a couple of steps at once for me: make a copy and rename it.&amp;nbsp; Unfortunately it doesn&amp;#39;t do that.&amp;nbsp; It makes a copy of the file (as &amp;quot;Copy of typename.xx&amp;quot;) but doesn&amp;#39;t rename any types in the class that match the file name.&lt;/p&gt;
&lt;p&gt;This might seem somewhat trivial... I can simply rename the file name then refactor rename the type in the file so that the type and all it&amp;#39;s constructors are renamed in one fell swoop.&amp;nbsp; Alas, this simply opens a can of worms that can completely confound a newcomer and annoy an expert.&lt;/p&gt;
&lt;p&gt;That simple, intuitive method of renaming a copy of a file then the type within the file actually renames *all* types of that name.&amp;nbsp; Since we&amp;#39;ve just made a copy of the type, that means it&amp;#39;s always going rename types in two files.&amp;nbsp; The side-effect of drag-copy in SE means you *must* manually rename the type in the file you just copied.&amp;nbsp; You can do this with search-replace; but that&amp;#39;s friction I don&amp;#39;t want and really makes SE drag-copy unusable.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=355239"&gt;logged a bug about it on Connect&lt;/a&gt;; but the olde &amp;quot;by design&amp;quot; card was played... &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1640926" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/.NET+Development/default.aspx">.NET Development</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Software+Development/default.aspx">Software Development</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Product+Bugs/default.aspx">Product Bugs</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Poor+UI/default.aspx">Poor UI</category></item><item><title>Resharper Isn't Always Smart</title><link>http://msmvps.com/blogs/peterritchie/archive/2008/03/31/resharper-isn-t-always-smart.aspx</link><pubDate>Mon, 31 Mar 2008 17:47:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1564070</guid><dc:creator>PeterRitchie</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/peterritchie/rsscomments.aspx?PostID=1564070</wfw:commentRss><comments>http://msmvps.com/blogs/peterritchie/archive/2008/03/31/resharper-isn-t-always-smart.aspx#comments</comments><description>&lt;p&gt;I was writing some code today, essentially like this:&lt;/p&gt;
&lt;div style="FONT-SIZE:10pt;BACKGROUND:white;COLOR:black;FONT-FAMILY:Courier New;"&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;public&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;class&lt;/span&gt; &lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;{&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;private&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt; value;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;public&lt;/span&gt; MyClass(&lt;span style="COLOR:blue;"&gt;int&lt;/span&gt; value)&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;this&lt;/span&gt;.value = value;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;public&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;static&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;bool&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;operator&lt;/span&gt;==(&lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt; left, &lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt; right)&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;return&lt;/span&gt; left.value == right.value;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;public&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;static&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;bool&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;operator&lt;/span&gt; !=(&lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt; left, &lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt; right)&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;return&lt;/span&gt; !(left == right);&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;}&lt;/p&gt;&lt;/div&gt;
&lt;div style="FONT-SIZE:10pt;BACKGROUND:white;COLOR:black;FONT-FAMILY:Courier New;"&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:green;"&gt;//...&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt; myClass1 = &lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; &lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt;(1);&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt; myClass2 = &lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; &lt;span style="COLOR:#2b91af;"&gt;MyClass&lt;/span&gt;(1);&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;if&lt;/span&gt;((&lt;span style="COLOR:#2b91af;"&gt;Object&lt;/span&gt;)myClass1 != (&lt;span style="COLOR:#2b91af;"&gt;Object&lt;/span&gt;)myClass2) &lt;span style="COLOR:green;"&gt;// &amp;quot;Type cast is reundant&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;not equal&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;else&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:#2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;equal&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;...where&amp;nbsp;Resharper warned that both the casts to Object were redundant and offered a &amp;quot;Quick-fix&amp;quot; (red light bulb) to &amp;quot;Remove cast&amp;quot;.&amp;nbsp; Well, doing that to one of the casts results in a compile error so you have to manually change the other; but what it&amp;#39;s suggesting is this:&lt;/p&gt;
&lt;div style="FONT-SIZE:10pt;BACKGROUND:white;COLOR:black;FONT-FAMILY:Courier New;"&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;if&lt;/span&gt;(myClass1 != myClass2)&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;This completely changes the output of my application from &amp;quot;not equal&amp;quot; to&amp;nbsp;&amp;quot;equal&amp;quot;.&amp;nbsp; What&amp;nbsp;Resharper&amp;nbsp;doesn&amp;#39;t know (or doesn&amp;#39;t care to check)&amp;nbsp;is that removing those casts switches from a reference comparison to a value comparison&amp;nbsp;and may&amp;nbsp;have different results.&amp;nbsp; What I wrote with the original code was to test if the two references&amp;nbsp;referenced the same object.&amp;nbsp; The default behaviour of a class is to do a reference check; but I&amp;#39;ve overloaded&amp;nbsp;operator== (and operator&amp;nbsp;!=) to perform a value comparison (I&amp;#39;ve left out the lovely&amp;nbsp;bits that truly&amp;nbsp;gives MyClass value semantics for clarity).&lt;/p&gt;
&lt;p&gt;So, when Resharper offers to change your code, be sure you know side-effects of that change before you let it do it.&amp;nbsp; You could introduce a nasty bug.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fmsmvps.com%2fblogs%2fpeterritchie%2farchive%2f2008%2f03%2f31%2fresharper-isn-t-always-smart.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fmsmvps.com%2fblogs%2fpeterritchie%2farchive%2f2008%2f03%2f31%2fresharper-isn-t-always-smart.aspx" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1564070" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Resharper/default.aspx">Resharper</category><category domain="http://msmvps.com/blogs/peterritchie/archive/tags/Product+Bugs/default.aspx">Product Bugs</category></item></channel></rss>