<?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>FxCop backlog themes: Exceptions</title><link>http://msmvps.com/blogs/calinoiu/archive/2007/05/05/fxcop-backlog-themes-exceptions.aspx</link><description>Since I started monitoring traffic on this blog a little more closely about a week ago, I had the unexpected surprise that the posts on HTML encoding and server vs. client cultures were getting a lot more hits than I expected. I had been planning on starting</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>FxCop backlog themes: Disposition and finalization</title><link>http://msmvps.com/blogs/calinoiu/archive/2007/05/05/fxcop-backlog-themes-exceptions.aspx#907803</link><pubDate>Wed, 16 May 2007 20:07:25 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:907803</guid><dc:creator>I may have joined the wrong side</dc:creator><description>I skipped ahead a while back with my post on the exceptions theme , and it&amp;#39;s time to get back on&lt;img src="http://msmvps.com/aggbug.aspx?PostID=907803" width="1" height="1"&gt;</description></item><item><title>re: FxCop backlog themes: Exceptions</title><link>http://msmvps.com/blogs/calinoiu/archive/2007/05/05/fxcop-backlog-themes-exceptions.aspx#892325</link><pubDate>Sun, 06 May 2007 11:48:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:892325</guid><dc:creator>calinoiu</dc:creator><description>&lt;p&gt;&amp;quot;value&amp;quot; is actually the name of the argument in the setter method (take a look in Reflector to see for yourself), and not all languages support the property syntax,&amp;nbsp;so it does make more sense to use the argument name rather than the property name in the ArgumentException. &amp;nbsp;When callers have to resort to using &amp;quot;set_YourProperty(value)&amp;quot;, an argument exception for &amp;quot;YourProperty&amp;quot; isn&amp;#39;t necessarily going to make a whole lot of sense. &amp;nbsp;Conversely, for those who can use the &amp;quot;YourProperty = value&amp;quot; syntax, the name &amp;quot;value&amp;quot; has implicit meaning and isn&amp;#39;t bound to create any problems in understanding the meaning of the exception message.&lt;/p&gt;
&lt;p&gt;As for what to throw for empty strings, the current guideline from Microsoft seems to be to throw a vanilla ArgumentException (see &lt;a href="http://blogs.msdn.com/fxcop/archive/2007/01/22/faq-what-exception-should-i-throw-instead-of-the-reserved-exceptions-found-by-donotraisereservedexceptiontypes.aspx" target="_new" rel="nofollow"&gt;blogs.msdn.com/.../faq-what-exception-should-i-throw-instead-of-the-reserved-exceptions-found-by-donotraisereservedexceptiontypes.aspx&lt;/a&gt;). &amp;nbsp;However, a lot of folks (including me) at FinRad aren&amp;#39;t always very comfortable with that, so we&amp;#39;re using an ArgumentEmptyException that inherits directly from ArgumentException and is meant to be thrown for both string and collection arguments that are inappropriately empty.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=892325" width="1" height="1"&gt;</description></item><item><title>re: FxCop backlog themes: Exceptions</title><link>http://msmvps.com/blogs/calinoiu/archive/2007/05/05/fxcop-backlog-themes-exceptions.aspx#892285</link><pubDate>Sun, 06 May 2007 10:33:36 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:892285</guid><dc:creator>Lothan</dc:creator><description>&lt;p&gt;One of the exception rules that has always puzzled me is CA2208 in regards to property getters and setters and exceptions. When testing for a null or empty string in a property setter, I throw ArgumentNullException(&amp;quot;Test&amp;quot;, &amp;quot;...&amp;quot;) where Test is the name of the property, but FxCop wants me to change this to ArgumentNullException(&amp;quot;value&amp;quot;). ArgumentNullException isn&amp;#39;t my first choice, but I can&amp;#39;t find a more appropriate exception to use in this case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=892285" width="1" height="1"&gt;</description></item></channel></rss>