<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>Code Analysis Team Blog : Code Metrics</title><link>http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx</link><description>Tags: Code Metrics</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Come chat with the Code Analysis team tomorrow</title><link>http://blogs.msdn.com/fxcop/archive/2007/12/04/come-chat-with-the-code-analysis-team-tomorrow.aspx</link><pubDate>Tue, 04 Dec 2007 20:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6655538</guid><dc:creator>David M. Kean</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/6655538.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=6655538</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=6655538</wfw:comment><description>&lt;P mce_keep="true"&gt;Join members of the Visual Studio Team System product group to discuss features available in Team Foundation Server, Team Suite, Architecture Edition, Development Edition, Database Edition, and Test Edition. In addition, discuss what's new for these editions for Visual Studio 2008.&lt;/P&gt;
&lt;P mce_keep="true"&gt;We will be holding two sessions:&lt;/P&gt;
&lt;P mce_keep="true"&gt;Join the &lt;A href="http://msdn.microsoft.com/chats"&gt;chat&lt;/A&gt; on Wednesday, December 5th, 2007 from 10:00am - 11:00am Pacific Time. &lt;A href="http://www.microsoft.com/communities/chats/vcs/07_1205_msdn_VSTS10.ics"&gt;Add to Calendar&lt;/A&gt; | &lt;A href="http://www.timeanddate.com/worldclock/fixedtime.html?month=12&amp;amp;day=5&amp;amp;year=2007&amp;amp;hour=10&amp;amp;min=0&amp;amp;sec=0&amp;amp;p1=234"&gt;Additional Time Zones&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -and-&lt;/P&gt;
&lt;P&gt;Join the &lt;A href="http://msdn.microsoft.com/chats"&gt;chat&lt;/A&gt; on Wednesday, December 5th, 2007 from 4:00pm - 5:00pm Pacific Time. &lt;A href="http://www.microsoft.com/communities/chats/vcs/07_1205_msdn_VSTS4.ics"&gt;Add to Calendar&lt;/A&gt; | &lt;A href="http://www.timeanddate.com/worldclock/fixedtime.html?month=12&amp;amp;day=5&amp;amp;year=2007&amp;amp;hour=16&amp;amp;min=0&amp;amp;sec=0&amp;amp;p1=234"&gt;Additional Time Zones&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6655538" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Community/default.aspx">Community</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis/default.aspx">Code Analysis</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/FxCop/default.aspx">FxCop</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis+Policy/default.aspx">Code Analysis Policy</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/tsbt-dev/default.aspx">tsbt-dev</category></item><item><title>Positioning Code Metrics to Management</title><link>http://blogs.msdn.com/fxcop/archive/2007/11/28/positioning-code-metrics-to-management.aspx</link><pubDate>Thu, 29 Nov 2007 01:08:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6585914</guid><dc:creator>conorm</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/6585914.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=6585914</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=6585914</wfw:comment><description>&lt;p&gt;Another question that is coming up is:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;How can (or should) code metrics be presented to management ?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;My view is that in all cases the metrics are something that can help make decisions around focus and prioritization. Management should be made aware of the metrics and what they mean to allow them to decide where to focus resources. If management is more levels away from the code then the Maintainability index can serve as a good, simple, metric.&lt;/p&gt;  &lt;p&gt;Sometimes you may ship code that has low maintainability or very high complexity etc. and management would make this decision based on risk, time and resources and perhaps other factors. Metrics helps them make that decision with quantitative data.&lt;/p&gt;  &lt;p&gt;Some possible options:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;     &lt;p&gt;One option is to present the metrics in terms of risk and mitigation. For example:&lt;/p&gt;      &lt;ol&gt;       &lt;li&gt;Risk: low maintainability in some module &lt;/li&gt;        &lt;li&gt;Mitigation: the module is reviewed. &lt;/li&gt;        &lt;li&gt;Risk: High cyclomatic complexity &lt;/li&gt;        &lt;li&gt;Mitigation: the module has a high number of test cases. &lt;/li&gt;     &lt;/ol&gt;   &lt;/li&gt;    &lt;li&gt;Another option is to evaluate the metrics on legacy code. This could be to select some code that is known to have lots of issues and then run the metrics on the code to see if metrics would report any issues with the code. This could be a good way to show value to management in the metrics themselves and make them case for them as a future preventative measure. &lt;/li&gt;    &lt;li&gt;Yet another option is to present a trend over time. Unfortunately the tool doesn't currently make this very easy but at each milestone of the project you can record the maintainability and other metrics for the modules. This could then be compared across time and used in future planning or to guide management in allocating time and resources to particular parts of the project that are trending badly. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I'd be very interested in hearing other approaches people have taken in presenting metrics or code analysis in general to management.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6585914" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/tsbt-dev/default.aspx">tsbt-dev</category></item><item><title>Maintainability Index Range and Meaning</title><link>http://blogs.msdn.com/fxcop/archive/2007/11/20/maintainability-index-range-and-meaning.aspx</link><pubDate>Tue, 20 Nov 2007 19:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6437143</guid><dc:creator>conorm</dc:creator><slash:comments>17</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/6437143.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=6437143</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=6437143</wfw:comment><description>&lt;P&gt;Another question:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The maintainability index has been re-set to lie between 0 and 100.&amp;nbsp; How and why was this done?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The metric originally was calculated as follows (based on the work in Carnegie Mellon University although we modified the Halstead Volume calculation a little since we don't include comments anywhere in our calculation): Maintainability Index = 171 - 5.2 * ln(Halstead Volume) - 0.23 * (Cyclomatic Complexity) - 16.2 * ln(Lines of Code)&lt;/P&gt;
&lt;P&gt;This meant that it ranged from 171 to an unbounded negative number.&amp;nbsp; We noticed that as code tended toward 0 it was clearly hard to maintain code and the difference between code at 0 and some negative value was not useful.&amp;nbsp;&amp;nbsp; I'll post some tech ed sample code showing very low maintainability or you can try on your own code to verify.&amp;nbsp; As a result of the decreasing usefulness of the negative numbers and a desire to keep the metric as clear as possible we decided to treat all 0 or less indexes as 0 and then re-base the 171 or less range to be from 0 to 100. Thus, the formula we use is:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://www.sei.cmu.edu/str/descriptions/mitmpm.html" mce_href="http://www.sei.cmu.edu/str/descriptions/mitmpm.html"&gt;Maintainability Index&lt;/A&gt; = MAX(0,(171 - 5.2 * ln(Halstead Volume) - 0.23 * (Cyclomatic Complexity) - 16.2 * ln(Lines of Code))*100 / 171)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;On top of that we decided to be conservative with the thresholds.&amp;nbsp; The desire was that if the index showed red then we would be saying with a high degree of confidence that there was an issue with the code.&amp;nbsp; This gave us the following thresholds (as mentioned in this blog previously):&lt;/P&gt;
&lt;P&gt;For the thresholds we decided to break down this 0-100 range 80-20 so that we kept the noise level low and only flagged code that was really suspicious. We have:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;0-9 = Red&lt;/LI&gt;
&lt;LI&gt;10-19 = Yellow&lt;/LI&gt;
&lt;LI&gt;20-100 = Green&lt;/LI&gt;&lt;/UL&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6437143" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis/default.aspx">Code Analysis</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/tsbt-dev/default.aspx">tsbt-dev</category></item><item><title>Code Metrics as Check-in Policy</title><link>http://blogs.msdn.com/fxcop/archive/2007/11/15/code-metrics-as-check-in-policy.aspx</link><pubDate>Fri, 16 Nov 2007 10:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6279586</guid><dc:creator>conorm</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/6279586.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=6279586</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=6279586</wfw:comment><description>&lt;P&gt;This is the first in a series of posts around questions I am getting asked related to code metrics.&lt;/P&gt;
&lt;P&gt;One question that is coming up is:&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Can a check-in policy be defined based on code metrics in TFS?&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;Well, code metrics itself does not have a check-in policy but fortunately the Maintainability Index, Class Coupling, Depth of Inheritance and Complexity metrics are all available as rules in Code Analysis in Visual Studio.&amp;nbsp; This means you can use code analysis check-in policy enabled with those rules.&amp;nbsp; The rules are grouped under the "Maintainability Rules" Category and are configured as follows: &lt;BR&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=2 width=621 border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=160&gt;&lt;B&gt;Metric&lt;/B&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=245&gt;Corresponding Rule&lt;/TD&gt;
&lt;TD class="" vAlign=top width=214&gt;Threshold&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=160&gt;Depth of Inheritance&lt;/TD&gt;
&lt;TD class="" vAlign=top width=246&gt;CA1501 &lt;A href="http://msdn2.microsoft.com/en-us/library/ms182213(VS.90).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms182213(VS.90).aspx"&gt;AvoidExcessiveInheritance&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=214&gt;Warning at above 5 levels deep&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=160&gt;Complexity&lt;/TD&gt;
&lt;TD class="" vAlign=top width=246&gt;CA1502 &lt;A href="http://msdn2.microsoft.com/en-us/library/ms182212(VS.90).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms182212(VS.90).aspx"&gt;AvoidExcessiveComplexity&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=214&gt;Warning at above 25&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=160&gt;
&lt;P&gt;Maintainability Index&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=246&gt;CA1505 &lt;A href="http://msdn2.microsoft.com/en-us/library/bb386043(VS.90).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb386043(VS.90).aspx"&gt;AvoidUnmaintainableCode&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=214&gt;Warning at below 20&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=160&gt;Class Coupling&lt;/TD&gt;
&lt;TD class="" vAlign=top width=246&gt;CA1506 &lt;A href="http://msdn2.microsoft.com/en-us/library/bb397994(VS.90).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb397994(VS.90).aspx"&gt;AvoidExcessiveClassCoupling&lt;/A&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=214&gt;
&lt;P&gt;Warning at above 80 for class and above 30 for a method&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;In the policy editor this would look like the following: &lt;/P&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" alt="Code Metrics as a check-in policy" src="http://blogs.msdn.com/blogfiles/conorm/WindowsLiveWriter/CodeMetricsasCheckinPolicy_F36A/image_2.png" border=0&gt; 
&lt;P&gt;This allows you to enforce that code meets these thresholds before check-in.&amp;nbsp; In future we are looking in to allowing the threshold values to be changed. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6279586" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis/default.aspx">Code Analysis</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis+Policy/default.aspx">Code Analysis Policy</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/tsbt-dev/default.aspx">tsbt-dev</category></item><item><title>Code Metrics Customization</title><link>http://blogs.msdn.com/fxcop/archive/2007/11/15/code-metrics-customization.aspx</link><pubDate>Fri, 16 Nov 2007 02:54:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6279992</guid><dc:creator>conorm</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/6279992.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=6279992</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=6279992</wfw:comment><description>&lt;p&gt;A number of people have asked:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Is there a way to customize the existing code metrics or add additional ones?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The simple answer at this time is No.&amp;#xA0; There are no extension points or customizations available at this time for code metrics.&amp;#xA0; This feature was added late in the cycle for VS 2008 and we were out of time to design and add the required hooks. We will use this release to gather feedback about the sorts of extensions you want.&amp;#xA0; &lt;/p&gt;  &lt;p&gt;To that end please feel free to &lt;strong&gt;&lt;em&gt;respond to this post with information about any customizations or additional metrics that would be of interest to you&lt;/em&gt;&lt;/strong&gt;. This will help us a lot in our future planning.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6279992" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Configuration/default.aspx">Configuration</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/tsbt-dev/default.aspx">tsbt-dev</category></item><item><title>New for Visual Studio 2008 - Code Metrics</title><link>http://blogs.msdn.com/fxcop/archive/2007/10/03/new-for-visual-studio-2008-code-metrics.aspx</link><pubDate>Wed, 03 Oct 2007 17:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5247585</guid><dc:creator>David M. Kean</dc:creator><slash:comments>39</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/5247585.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=5247585</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=5247585</wfw:comment><description>&lt;P&gt;While we've already briefly spoken about Code Metrics &lt;A href="http://blogs.msdn.com/fxcop/archive/2007/02/28/announcing-visual-studio-code-metrics.aspx" mce_href="http://blogs.msdn.com/fxcop/archive/2007/02/28/announcing-visual-studio-code-metrics.aspx"&gt;when we announced it&lt;/A&gt;, I thought I would discuss it in a little more depth, in particular the metrics it provides.&lt;/P&gt;
&lt;P&gt;As mentioned previously, Code Metrics is a new tool window that helps users find and act upon complex and unmaintainable areas within an application. &lt;/P&gt;
&lt;P&gt;The following shows the results of running Code Metrics over a fictional business application:&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=450 alt="Code Metrics Results tool window" src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/CodeMetrics_3.png" width=867 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/CodeMetrics_3.png"&gt; &lt;/P&gt;
&lt;P&gt;As you can see from above, for Visual Studio 2008, we're providing five metrics. These are detailed below.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Class Coupling&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;At each level, this indicates the total number of dependencies that the item has on other types. This number excludes primitive and built-in types such as Int32, String and Object. The higher this number, the more likely changes in other types will ripple though this item. A lower value at the type level can indicate candidates for possible reuse.&lt;/P&gt;
&lt;P&gt;The following shows how coupling is calculated:&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=446 alt="Class Coupling" src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/ClassCoupling_3.png" width=583 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/ClassCoupling_3.png"&gt; &lt;/P&gt;
&lt;P align=left&gt;For example, as you can see above, &lt;STRONG&gt;Account &lt;/STRONG&gt;is coupled to two other types, &lt;STRONG&gt;Address&lt;/STRONG&gt; and &lt;STRONG&gt;Order&lt;/STRONG&gt;, whereas &lt;STRONG&gt;Country&lt;/STRONG&gt; is not dependent on any other type.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Depth of Inheritance&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;At the type level, depth of inheritance indicates the number of types that are above the type in the inheritance tree. For example, a type that derives directly from Object would have a depth of inheritance of 1. At the namespace and project level, this indicates the highest depth of inheritance of all the types contained within it. This number does not take into consideration the depth of any implemented interfaces. Deep inheritance trees can indicate an over-engineering of a problem and can increase the complexity of testing and maintaining an application. &lt;/P&gt;
&lt;P&gt;The following shows how depth is calculated:&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=454 alt="Depth Of Inheritance" src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/DepthOfInheritance_6.png" width=660 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/DepthOfInheritance_6.png"&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;For example, in the above inheritance hierarchy, &lt;STRONG&gt;ListControl&lt;/STRONG&gt; and &lt;STRONG&gt;Label &lt;/STRONG&gt;have a depth of inheritance of 3, whereas &lt;STRONG&gt;Component&lt;/STRONG&gt; has a depth of inheritance of 1.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Cyclomatic Complexity &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;At each level, this measures the total number of individual paths through the code. This is basically calculated by counting the number of decision points (such as &lt;STRONG&gt;if&lt;/STRONG&gt; blocks, &lt;STRONG&gt;switch&lt;/STRONG&gt;&lt;EM&gt; &lt;/EM&gt;cases, and &lt;STRONG&gt;do&lt;/STRONG&gt;, &lt;STRONG&gt;while&lt;/STRONG&gt;,&lt;STRONG&gt; foreach&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/STRONG&gt;and &lt;STRONG&gt;for&lt;/STRONG&gt;&lt;EM&gt; &lt;/EM&gt;loops) and adding 1. This number is also a good indication on the number of unit tests it will take to achieve full line coverage. Lower is typically better.&lt;/P&gt;
&lt;P&gt;The following shows how complexity is calculated:&lt;/P&gt;
&lt;P align=center&gt;&amp;nbsp;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=485 alt="Cyclomatic Complexity" src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/CyclomaticComplexity_3.png" width=666 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/CyclomaticComplexity_3.png"&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Lines of Code&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;At each level, this is a measure of the total number of executable lines of code. This excludes white space, comments, braces and the declarations of members, types and namespaces themselves. Lower is typically better.&lt;/P&gt;
&lt;P&gt;The following shows how the lines are calculated:&lt;/P&gt;
&lt;P align=center&gt;&amp;nbsp;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=582 alt="Lines of Code" src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/LinesOfCode_3.png" width=666 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/LinesOfCode_3.png"&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Maintainability Index&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;At the member and type level, this is an index from 0 to 100 indicating the overall maintainability of the member or type. At the namespace and assembly level, this is an average of the maintainability index of all types contained within it. This index is based on several other metrics, including &lt;EM&gt;Halstead Volume&lt;/EM&gt; (which factors in the number and use of operands and operators), Cyclomatic Complexity and Lines of Code. A low number indicates code that is complex and hard to maintain.&lt;/P&gt;
&lt;P&gt;The Maintainability Index column also includes a icon that gives a quick indication as to the overall maintainability and complexity of a particular item. The following table shows the range at which an icon is shown:&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV align=center&gt;
&lt;TABLE class="" cellSpacing=0 cellPadding=2 width=591 border=0&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=top width=43&gt;
&lt;P align=left&gt;&lt;STRONG&gt;Icon&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=252&gt;
&lt;P align=left&gt;&lt;STRONG&gt;Level&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=top width=294&gt;
&lt;P align=left&gt;&lt;STRONG&gt;Range&lt;/STRONG&gt; &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=center width=44&gt;
&lt;P align=center&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=16 alt=Green src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/Green_3.png" width=16 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/Green_3.png"&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" width=252&gt;
&lt;P align=left&gt;High Maintainability&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" width=294&gt;
&lt;P align=left&gt;Between 20 and 100 inclusive&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=center width=44&gt;
&lt;P align=center&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=16 alt=Yellow src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/Yellow_5.png" width=16 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/Yellow_5.png"&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=center width=252&gt;
&lt;P align=left&gt;Moderate Maintainability&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" width=294&gt;
&lt;P align=left&gt;Between 10 and 19 inclusive&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="" vAlign=center width=44&gt;
&lt;P align=center&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=16 alt=Red src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/Red_3.png" width=16 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008CodeMetrics_D90B/Red_3.png"&gt; &lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" vAlign=center width=252&gt;
&lt;P align=left&gt;Low Maintainability&lt;/P&gt;&lt;/TD&gt;
&lt;TD class="" width=380&gt;
&lt;P align=left&gt;Between 0 and 9 inclusive&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;
&lt;DIV align=left&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV align=left&gt;These icons allow you to see at a glance any trouble spots that you should start to focusing on or filling bugs against.&lt;/DIV&gt;
&lt;DIV align=left&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV align=left&gt;&lt;STRONG&gt;Conclusion&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV align=left&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/DIV&gt;
&lt;DIV align=left&gt;Now that you know what these metrics measure, and how they are calculated, the next thing you'll want to know is what you should do when you start to see some red in your application. In a future post, I will cover why should should care about each metric, and how to go about fixing some of the common issues that cause particular metrics to high (or low in the case of Maintainability Index).&lt;/DIV&gt;
&lt;DIV align=left&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5247585" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Team+System/default.aspx">Team System</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/tsbt-dev/default.aspx">tsbt-dev</category></item><item><title>New for Visual Studio 2008 - The 'Analyze' menu</title><link>http://blogs.msdn.com/fxcop/archive/2007/09/22/new-for-visual-studio-2008-the-analyze-menu.aspx</link><pubDate>Sat, 22 Sep 2007 17:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5004975</guid><dc:creator>David M. Kean</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/5004975.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=5004975</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=5004975</wfw:comment><description>&lt;P&gt;While Ian Huff has already &lt;A href="http://blogs.msdn.com/ianhu/archive/2007/08/07/the-new-developer-menu-in-visual-studio-team-system.aspx" mce_href="http://blogs.msdn.com/ianhu/archive/2007/08/07/the-new-developer-menu-in-visual-studio-team-system.aspx"&gt;talked about the new 'Developer' menu&lt;/A&gt; that has been added to Visual Studio 2008, I thought I would briefly mention some of the changes to it that were made between Beta 2 and RTM.&lt;/P&gt;
&lt;P&gt;For those that have yet to see this menu, similar to the existing &lt;STRONG&gt;Test&lt;/STRONG&gt; menu, we've added a new top-level menu that will contain the Code Analysis, Code Metrics and Profiling menu items. This was done for discoverability reasons, and something we hope to leverage moving forward towards &lt;A href="http://msdn2.microsoft.com/en-us/teamsystem/bb725993.aspx" mce_href="http://msdn2.microsoft.com/en-us/teamsystem/bb725993.aspx"&gt;Rosario&lt;/A&gt;.&lt;/P&gt;
&lt;P align=center&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=312 alt="New Analyze menu" src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008TheAnalyzemenu_11837/AnalyzeMenu_3.png" width=759 border=0 mce_src="http://blogs.msdn.com/blogfiles/fxcop/WindowsLiveWriter/NewforVisualStudio2008TheAnalyzemenu_11837/AnalyzeMenu_3.png"&gt; &lt;/P&gt;
&lt;P&gt;A quick rundown on some of the things that have changed since Beta 2:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Renamed the menu itself from the very non-specific &lt;STRONG&gt;Developer&lt;/STRONG&gt; to the little bit more descriptive &lt;STRONG&gt;Analyze.&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Removed the &lt;STRONG&gt;Code Analysis&lt;/STRONG&gt; and &lt;STRONG&gt;Code Metrics&lt;/STRONG&gt; sub menus and pulled their associated menu items up one level.&lt;/LI&gt;
&lt;LI&gt;Pulled &lt;STRONG&gt;New Diff Report&lt;/STRONG&gt; up one level and renamed it to &lt;STRONG&gt;Compare Performance Reports...&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;Renamed the Code Metrics and Code Analysis menu items: &lt;BR&gt;&lt;STRONG&gt;Generate Code Metrics&lt;/STRONG&gt; -&amp;gt; &lt;STRONG&gt;Calculate Code Metrics&lt;/STRONG&gt;. &lt;BR&gt;&lt;STRONG&gt;Migrate Code Analysis Policy Settings to Solution&lt;/STRONG&gt; -&amp;gt; &lt;STRONG&gt;Code Analysis Settings for Solution&lt;/STRONG&gt;. &lt;BR&gt;&lt;STRONG&gt;Replace Code Analysis Settings with Code Analysis Policy Settings&lt;/STRONG&gt; -&amp;gt; &lt;STRONG&gt;Replace with Check-in Policy &lt;BR&gt;&lt;/STRONG&gt;&lt;STRONG&gt;Add Code Analysis Policy Settings to Code Analysis Settings&lt;/STRONG&gt; -&amp;gt; &lt;STRONG&gt;Merge with Check-in Policy &lt;BR&gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I probably don't have to tell that these changes, that we made to increase the usability of the menu, are great improvements, especially the renaming of probably what would have been in the running for the longest menu item in Visual Studio; &lt;STRONG&gt;Replace Code Analysis Settings with Code Analysis Policy Settings.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;While a very small addition to Visual Studio 2008, we hope the new &lt;STRONG&gt;Analyze&lt;/STRONG&gt; menu helps improve your workflow when working with the Code Analysis and Profiler features.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5004975" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Team+System/default.aspx">Team System</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis/default.aspx">Code Analysis</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis+Policy/default.aspx">Code Analysis Policy</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/tsbt-dev/default.aspx">tsbt-dev</category></item><item><title>Code Analysis (Team System) Chat Roundup</title><link>http://blogs.msdn.com/fxcop/archive/2007/05/02/code-analysis-msdn-chat-roundup.aspx</link><pubDate>Wed, 02 May 2007 18:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2362067</guid><dc:creator>David M. Kean</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/2362067.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=2362067</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=2362067</wfw:comment><description>&lt;P&gt;We had &lt;A class="" href="http://blogs.msdn.com/fxcop/archive/2007/04/22/code-analysis-team-system-chat-this-friday.aspx" mce_href="http://blogs.msdn.com/fxcop/archive/2007/04/22/code-analysis-team-system-chat-this-friday.aspx"&gt;two great chats last Friday&lt;/A&gt;. Thank-you to all that attended, I had a lot of fun.&lt;/P&gt;
&lt;P&gt;The following is a list of Code Analysis questions that were asked:&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Code Metrics&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 12pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;JeffBe: I'm very interested in the code metrics, are these integrated into build reports though? We'd like to be able to track code metrics over time.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;This is something that we've received a lot requests for. Unfortunately, for Orcas we won't be integrating this into TeamBuild or any sort of reports. However, this is definitely something that we want to do in a future release.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Where can i find more information about CyclomaticComplexity feature in Orcas ?&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Besides what we've already published on our blog (&lt;A href="http://blogs.msdn.com/fxcop/"&gt;http://blogs.msdn.com/fxcop/&lt;/A&gt;), there's not much information around at the moment. This will change in Beta 2, we also do plan on doing more in-depth posts on the blog in the coming months.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;I'll ask the audience. What would be your preference on something that we should focus on in Code Metrics? 1) TeamBuild integration 2) Extensibility (the ability to add your own metrics) 3) Policy Enforcement of Metrics (being able to prevent check-ins of code that doesn't pass a certain threshold of maintainability. 4) More extensive metrics&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;Extensibility, enforcement, more extensive metrics (in that order)&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Thanks Peter. You want to plug in your own metrics? Do you think we're missing some?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;metrics.&amp;nbsp; Complexity is a bit subjective--that's something that would be best suited to customization.&amp;nbsp; I'd be a big proponent of something that measures degree of Law of Demeter violations...&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Yes we've heard that. This is one of the reasons we really want to wait to see what customization customers really want. ie Do they simply want to tweak the numbers that make up the magic 'Maintainability Index', or do they want to completely replace the metric altogether.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Code Analysis&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Did you have to do anything special with CodeAnalysis in Orcas to support multiple versions of the .NET Framework?&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;The great thing about Orcas is that we actually get this for free. The new MSBuild mult-targeting means that you simply select the Framework you want to build against and Code Analysis&amp;nbsp; 'just works'.&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Any idea if nStatic-like features will be added to code analysis?&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;While I haven't yet played around with nStatic (I don't believe it has been released), we are looking at doing a lot more advanced analysis in a future version of Visual Studio.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Any added Code Analysis rules for C# 3.0 language extensions?&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Unfortunately no. Similar to the introduction of the .NET 1.0, it’s still not very clear on the gotchas and mistakes that people make when writing Linq. With regards to the other features, such as Extension methods, Automatic Properties, etc what would you like to see?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;The Static Analysis results are published to the data warehouse, will we ever see them in the build reports? Or is there a way to customise the build reports to include them?&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Grant, I'm not an expert on our integration with Team Build, but I'll certainly pass this request onto them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;&amp;nbsp;I guess I'm out of luck on var (doesn't make it into the assembly, per se).&amp;nbsp; I know many people watching C# 3. demos are really put off by wholesale abilities of their developers to use features like extension methods.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;It's pretty likely that you won't see any rules from us 'stating' don't use Extension methods. ;) However, this wouldn't be too hard to write a simple rule to do this. We are thinking about releasing rule samples when Orcas releases, I'll make sure this gets chucked in.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;to specifically answer your question "...missing some".&amp;nbsp; Not really, other than possibly new C# 3.0 stuff.&amp;nbsp; Most of the rules would be very specific to either an in-house class library or the way one shop mandates coding/design.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;As you know, a lot of the C# 3.0/VB 9 improvements are simply syntactic sugar over IL. So it actually makes it hard to write rules that target them. What I actually meant though, do you think we're missing some metrics?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Custom Rules&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;David: Question for you, in addition to FxCop do you think a tool similar to StyleCop will be available in the future? Although API level code analysis is great there are certain rules we'd like to enforce on non-public code constructs.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;As you well know, FxCop/Managed Code Analysis currently runs over an assembly and not actually the source code. To change this would be a significant change. However, in saying that, this is one of many features we may consider doing in a future release, however, if we do end up doing it, it’s likely to be more a long term feature, rather than short term. For the next couple of versions at least, you will still see binary analysis.&lt;/SPAN&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;&amp;nbsp;I think the greatest potential of TFS/CodeAnalysis is in customization.&amp;nbsp; Given it's something that makes it to the assembly level, for shops to be able to define their custom rules and enforce them at check-in would be a huge plus.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Peter we hear ya loud and clear. This is definitely something that we want to focus on in the future. The question is, do we focus on making rules more customizable or do we&amp;nbsp; focus on allow teams to write their own rules? What does everyone think?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&amp;nbsp;RE: customizable/rule-creation.&amp;nbsp; I think rule creation would tend to be more accepted.&amp;nbsp; Most of the shops I deal with accept most of the out-of-the-box rules and I can't think of many that could be improved by customization (bar metrics...).&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;What about naming/casing guidelines? Do you see many shops wanting to customize these or are they happy following the Design Guidelines?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q. &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;We do having naming standards that are a subset of the Design Guideline, i.e. we've made some rules more restrictive so we would want to customise these.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Good to know. Will bring this to the product team.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;FxCop&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Is a release of FxCop planned to coincide with the RTM of Orcas? What classes of code analysis with TFS include that FxCop won't?&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;It is likely that the next version of FxCop will be released sometime around the release of Orcas. Things that are included in Visual Studio that FxCop does not have are (but not limited to); Code Analysis Policy (the ability to enforce that code passes particular rules on check-in), Maintainability and Reliability rules, Code Metrics, out-of-the-box support for MSBuild (so warnings can be displayed in the Error List) and a few other features.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Are there any updates coming to FxCop 1.35? It's been a long time since release, and there are several bugs.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;Although I can't get give an exact date, we do plan on releasing an update to FxCop sometime in the next quarter.&amp;nbsp; What bugs are you hitting?&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'"&gt;DavidKean_MS (Moderator):&lt;BR&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;Q: &lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Arial','sans-serif'"&gt;The fxcop bugs are generally "rule exceptions". We have worked around some of them (disabling rules), but this is not ideal. We have 100s of projects and it is hard to manage.&lt;BR&gt;&lt;B&gt;A: &lt;/B&gt;By 'rule exceptions' do you mean crashing rules? Can you make sure that we know about these over on the Code Analysis forum (&lt;A href="http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=98"&gt;http://forums.microsoft.com/msdn/ShowForum.aspx?ForumID=98&lt;/A&gt;)? We have fixed a lot of these since 1.35, however, I want to make sure we fixed the ones you've encountered.&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2362067" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Community/default.aspx">Community</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Team+System/default.aspx">Team System</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis/default.aspx">Code Analysis</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/FxCop/default.aspx">FxCop</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category></item><item><title>Correct usage of the CompilerGeneratedAttribute and the GeneratedCodeAttribute</title><link>http://blogs.msdn.com/fxcop/archive/2007/04/27/correct-usage-of-the-compilergeneratedattribute-and-the-generatedcodeattribute.aspx</link><pubDate>Fri, 27 Apr 2007 18:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2294043</guid><dc:creator>David M. Kean</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/2294043.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=2294043</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=2294043</wfw:comment><description>&lt;P&gt;Both Code Analysis, FxCop&amp;nbsp;and Code Metrics make extensive use of &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.compilergeneratedattribute.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.compilergeneratedattribute.aspx"&gt;CompilerGeneratedAttribute&lt;/A&gt; and &lt;A class="" href="http://msdn2.microsoft.com/en-us/library/system.codedom.compiler.generatedcodeattribute.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.codedom.compiler.generatedcodeattribute.aspx"&gt;GeneratedCodeAttribute&lt;/A&gt;&amp;nbsp;to distinguish between user-written code and tool and compiler generated code.&lt;/P&gt;
&lt;P&gt;The following describes this behavior:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Code Analysis in Visual Studio 2005 and FxCop 1.35&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;- &lt;STRONG&gt;Compiler Generated.&lt;/STRONG&gt; Does not raise warnings against compiler generated code. Uses an algorithm (mainly based on the name) to determine if code is&amp;nbsp;compiler generated.&lt;BR&gt;- &lt;STRONG&gt;Tool Generated.&lt;/STRONG&gt; Raises warnings against nearly all tool generated code.&amp;nbsp;Uses an algorithm to turn off particular rules against code marked with &lt;STRONG&gt;GeneratedCodeAttribute &lt;/STRONG&gt;and generated by specific code generators.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Code Analysis in Visual Studio 2008 and FxCop 1.36&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;- Compiler Generated.&lt;/STRONG&gt; Does not raise any warnings against code marked with the &lt;STRONG&gt;CompilerGeneratedAttribute&lt;/STRONG&gt;. Also users&amp;nbsp;an algorithm to determine if other code&amp;nbsp;is compiler generated.&lt;BR&gt;&lt;STRONG&gt;- Tool Generated.&lt;/STRONG&gt; Does not raise warnings against code marked with the &lt;STRONG&gt;GeneratedCodeAttribute&lt;/STRONG&gt; if &lt;A class="" href="http://blogs.msdn.com/fxcop/archive/2006/12/21/two-new-features-for-orcas.aspx" mce_href="http://blogs.msdn.com/fxcop/archive/2006/12/21/two-new-features-for-orcas.aspx"&gt;Suppress results from generated code&lt;/A&gt; is turned on (the default).&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Code Metrics in Visual Studio 2008&lt;/STRONG&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;- Compiler Generated. &lt;/STRONG&gt;Does not display or generate metrics for code marked with the &lt;STRONG&gt;CompilerGeneratedAttribute&lt;/STRONG&gt;. Also users&amp;nbsp;an algorithm to determine if other code&amp;nbsp;is compiler generated.&lt;BR&gt;- &lt;STRONG&gt;Tool Generated&lt;/STRONG&gt;. Does not display or generate metrics for code marked with the &lt;STRONG&gt;GeneratedCodeAttribute&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Unfortunately, there are many cases of incorrect usage of these attributes both internally and externally of Microsoft, and this blog post is an attempt to make things a little clearer in the correct application of these attributes.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;CompilerGenerateAttribute&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This attribute is for compiler use&amp;nbsp;only and indicates that a particular code element is compiler generated. This should never be used in source code whatsoever. In fact, &lt;A class="" href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=270857" mce_href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=270857"&gt;some users believe that usage of it should be a compilation error&lt;/A&gt;. I tend to agree.&lt;/P&gt;
&lt;P&gt;For example, the following is an incorrect usage of this attribute (this is not compiler generated code):&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; A strongly-typed resource class, for looking up localized strings, etc.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;/summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// This class was auto-generated by the StronglyTypedResourceBuilder&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// class via a tool like ResGen or Visual Studio.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// To add or remove a member, edit your .ResX file then rerun ResGen&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt;// with the /str option, or rebuild your VS project.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DebuggerNonUserCodeAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;()]&lt;BR&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color=#2b91af size=2&gt;CompilerGeneratedAttribute&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;()]&lt;/STRONG&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;internal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Resources&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ResourceManager&lt;/FONT&gt;&lt;FONT size=2&gt; resourceMan;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;CultureInfo&lt;/FONT&gt;&lt;FONT size=2&gt; resourceCulture;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;SuppressMessageAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Microsoft.Performance"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"CA1811:AvoidUncalledPrivateCode"&lt;/FONT&gt;&lt;FONT size=2&gt;)]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;internal&lt;/FONT&gt;&lt;FONT size=2&gt; Resources()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; Returns the cached ResourceManager instance used by this class.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;/summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;EditorBrowsableAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;EditorBrowsableState&lt;/FONT&gt;&lt;FONT size=2&gt;.Advanced)]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;internal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ResourceManager&lt;/FONT&gt;&lt;FONT size=2&gt; ResourceManager&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;get&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;if&lt;/FONT&gt;&lt;FONT size=2&gt; ((resourceMan == &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;null&lt;/FONT&gt;&lt;FONT size=2&gt;))&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ResourceManager&lt;/FONT&gt;&lt;FONT size=2&gt; temp = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ResourceManager&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"WindowsApplication1.Properties.Resources"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Resources&lt;/FONT&gt;&lt;FONT size=2&gt;).Assembly);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resourceMan = temp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; resourceMan;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; Overrides the current thread's CurrentUICulture property for all&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; resource lookups using this strongly typed resource class.&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;///&lt;/FONT&gt;&lt;FONT color=#008000 size=2&gt; &lt;/FONT&gt;&lt;FONT color=#808080 size=2&gt;&amp;lt;/summary&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;EditorBrowsableAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;EditorBrowsableState&lt;/FONT&gt;&lt;FONT size=2&gt;.Advanced)]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;internal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;CultureInfo&lt;/FONT&gt;&lt;FONT size=2&gt; Culture&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;get &lt;/FONT&gt;&lt;FONT size=2&gt;{ &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; resourceCulture; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;set &lt;/FONT&gt;&lt;FONT size=2&gt;{ resourceCulture = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;FONT size=2&gt;; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;GeneratedCodeAttribute&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;This attribute is for use by custom tools that generate code. It should only be&amp;nbsp;applied&amp;nbsp;to code that is re-generated over and over and &lt;EM&gt;should not&lt;/EM&gt; be used by templates that the user is expected to modify. Nor should it be applied at the type level if the type being generated is a &lt;EM&gt;partial &lt;/EM&gt;class. In this situation, it should be applied only against the individual members that are contained within the generated part of the type.&lt;/P&gt;
&lt;P mce_keep="true"&gt;For example, the following shows the incorrect usage of this attribute (it is being applied at the type level to a partial class):&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;[&lt;/STRONG&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color=#2b91af size=2&gt;GeneratedCodeAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"9.0.0.0"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;)]&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;internal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;sealed&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;STRONG&gt;partial&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt; : &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ApplicationSettingsBase&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt; defaultInstance = ((&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt;)(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ApplicationSettingsBase&lt;/FONT&gt;&lt;FONT size=2&gt;.Synchronized(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt;())));&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt; Default &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; defaultInstance; }&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;UserScopedSettingAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;()]&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DebuggerNonUserCodeAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;()]&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DefaultSettingValueAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;""&lt;/FONT&gt;&lt;FONT size=2&gt;)]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; MySetting &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; ((&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt;)(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"MySetting"&lt;/FONT&gt;&lt;FONT size=2&gt;])); }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"MySetting"&lt;/FONT&gt;&lt;FONT size=2&gt;] = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;FONT size=2&gt;; }&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT size=2&gt;The following shows the correct usage of this attribute:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT color=#0000ff size=2&gt;internal&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;sealed&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;STRONG&gt;partial&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt; : &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ApplicationSettingsBase&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;BR&gt;{&lt;BR&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;FONT color=#2b91af size=2&gt;GeneratedCodeAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"&lt;/FONT&gt;&lt;FONT size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"9.0.0.0"&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size=2&gt;&lt;STRONG&gt;)]&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt; defaultInstance = ((&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt;)(&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;ApplicationSettingsBase&lt;/FONT&gt;&lt;FONT size=2&gt;.Synchronized(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt;())));&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;GeneratedCodeAttribute&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"9.0.0.0"&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;)]&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;Settings&lt;/FONT&gt;&lt;FONT size=2&gt; Default &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; defaultInstance; }&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;FONT color=#0000ff&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;GeneratedCodeAttribute&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;, &lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"9.0.0.0"&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt;)]&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;UserScopedSettingAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;()]&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DebuggerNonUserCodeAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;()]&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;[&lt;/FONT&gt;&lt;FONT color=#2b91af size=2&gt;DefaultSettingValueAttribute&lt;/FONT&gt;&lt;FONT size=2&gt;(&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;""&lt;/FONT&gt;&lt;FONT size=2&gt;)]&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; MySetting &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; ((&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt;)(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"MySetting"&lt;/FONT&gt;&lt;FONT size=2&gt;])); }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;/FONT&gt;&lt;FONT size=2&gt; { &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;this&lt;/FONT&gt;&lt;FONT size=2&gt;[&lt;/FONT&gt;&lt;FONT color=#a31515 size=2&gt;"MySetting"&lt;/FONT&gt;&lt;FONT size=2&gt;] = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;value&lt;/FONT&gt;&lt;FONT size=2&gt;; }&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;Unfortunately, due to the sheer number of teams within Microsoft that release tool generators and templates (there are hundreds within Visual Studio itself), it becomes impossible to track down all usages of these.&lt;/FONT&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Therefore, if you encounter any incorrect usages of these attributes, free feel to head over to &lt;A class="" href="https://connect.microsoft.com/feedback/default.aspx?SiteID=210&amp;amp;wa=wsignin1.0" mce_href="https://connect.microsoft.com/feedback/default.aspx?SiteID=210&amp;amp;wa=wsignin1.0"&gt;Microsoft Connect&lt;/A&gt; and tell us about it.&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=2294043" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Team+System/default.aspx">Team System</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Analysis/default.aspx">Code Analysis</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Bugs/default.aspx">Bugs</category></item><item><title>Announcing Visual Studio Code Metrics!</title><link>http://blogs.msdn.com/fxcop/archive/2007/02/28/announcing-visual-studio-code-metrics.aspx</link><pubDate>Wed, 28 Feb 2007 19:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1431554</guid><dc:creator>David M. Kean</dc:creator><slash:comments>57</slash:comments><comments>http://blogs.msdn.com/fxcop/comments/1431554.aspx</comments><wfw:commentRss>http://blogs.msdn.com/fxcop/commentrss.aspx?PostID=1431554</wfw:commentRss><wfw:comment>http://blogs.msdn.com/fxcop/rsscomments.aspx?PostID=1431554</wfw:comment><description>&lt;P&gt;Announcing the new Code Metrics feature for Visual Studio ‘Orcas’! Available in Visual Studio Team Developer and Team Suite, this new feature allows&amp;nbsp;users to generate code metrics for projects and solutions and displays the results in the Code Metrics Results tool window:&lt;/P&gt;
&lt;P&gt;&lt;IMG style="WIDTH: 894px; HEIGHT: 336px" height=336 src="http://blogs.msdn.com/photos/fxcop/images/1774483/original.aspx" width=894 mce_src="http://blogs.msdn.com/photos/fxcop/images/1774483/original.aspx"&gt;&lt;/P&gt;
&lt;P&gt;As you can see above, this feature currently calculates five different metrics; Maintainability Index, Cyclomatic Complexity, Depth of Inheritance, Class Coupling, and Lines of Code. All metrics are averaged at the type, namespace, and assembly levels with the exception of Class Coupling. The Class Coupling metric displays the total number of distinct types referenced at the method and type levels rather than the total number of type references. This is why above, the ProgramLibrary type’s class coupling is 83 instead of 103.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Users will&amp;nbsp;are able&amp;nbsp;to sort the results in the window by column. For example, above the results are sorted by the Maintainability Index column. Note that the proper hierarchy is maintained after sorting. &lt;/P&gt;
&lt;P mce_keep="true"&gt;Users can also filter the results from a particular metric for values between a specified minimum and maximum value. As you can see in&amp;nbsp;below the results of filtering out any results with a Maintainability Index greater than twenty are displayed. (The Library project is still displayed because it contains the code elements within the filter.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;IMG src="http://blogs.msdn.com/photos/fxcop/images/1774501/original.aspx" mce_src="http://blogs.msdn.com/photos/fxcop/images/1774501/original.aspx"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;The Maintainability Index column includes a maintainability indicator light that changes based on the maintainability of the code. Green indicates good maintainability, yellow indicates moderate maintainability, and red indicates poor maintainability. The thresholds for the maintainability indicator light and the scale of the Maintainability Index column are still being finalized. Look for more information on this in future blog posts.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Users can also export these results into Excel where they can perform their own calculations and transformations.&lt;/P&gt;
&lt;P&gt;Finally, to generate code metrics, simply do the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;In &lt;STRONG&gt;Solution Explorer&lt;/STRONG&gt;, right-click on&amp;nbsp;your solution/project and choose &lt;STRONG&gt;Generate Code Metrics&lt;/STRONG&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;IMG src="http://blogs.msdn.com/photos/fxcop/images/1774559/original.aspx" mce_src="http://blogs.msdn.com/photos/fxcop/images/1774559/original.aspx"&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Download the&amp;nbsp;March CTP&amp;nbsp;(either as a &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=B533619A-0008-4DD6-9ED1-47D482683C78&amp;amp;displaylang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=B533619A-0008-4DD6-9ED1-47D482683C78&amp;amp;displaylang=en"&gt;Virtual PC image&lt;/A&gt; or a &lt;A class="" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=cf76fcba-07af-47ac-8822-4ad346210670&amp;amp;DisplayLang=en" mce_href="http://www.microsoft.com/downloads/details.aspx?FamilyID=cf76fcba-07af-47ac-8822-4ad346210670&amp;amp;DisplayLang=en"&gt;self-extracting install&lt;/A&gt;)&amp;nbsp;and tell us what you think! What do you like? What needs improvement?&amp;nbsp;And if we were to add support for additional metrics in the future which ones are you most interested in seeing? &lt;/P&gt;
&lt;P mce_keep="true"&gt;Todd King&lt;BR&gt;Visual Studio Code Analysis Team&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1431554" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/fxcop/archive/tags/Team+System/default.aspx">Team System</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://blogs.msdn.com/fxcop/archive/tags/Code+Metrics/default.aspx">Code Metrics</category></item></channel></rss>