<?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 of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx</link><description>For the (real) inaugural post, Michael Fanning explains why some shipped Microsoft managed assemblies have fxcop violations, a very good question. It's also a good insight into how we use FxCop internally at MS. -----Original Message----- From: &amp;lt;An</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>FxCop gets a blog...</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#48890</link><pubDate>Fri, 09 Jan 2004 07:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:48890</guid><dc:creator>BradA's WebLog</dc:creator><description /></item><item><title>re: Code Analysis of Microsoft Assemblies (Michael Fanning)</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#48985</link><pubDate>Fri, 09 Jan 2004 12:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:48985</guid><dc:creator>PP</dc:creator><description>All very well but FXcop violations are not limited to the .NET framework assemblies. All the &amp;quot;best Practice&amp;quot; Applications blocks released by the patterns and practices folks at Microsoft have loads of Fxcop violations as well. As an example , the Data Access Application Block contains 50 violations !!</description></item><item><title>New and Notable 34</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#49005</link><pubDate>Fri, 09 Jan 2004 17:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49005</guid><dc:creator>Sam Gentile's Blog</dc:creator><description /></item><item><title>New and Notable 34</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#49008</link><pubDate>Fri, 09 Jan 2004 17:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49008</guid><dc:creator>Sam Gentile's Blog</dc:creator><description /></item><item><title>re: Code Analysis of Microsoft Assemblies (Michael Fanning)</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#49021</link><pubDate>Fri, 09 Jan 2004 14:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49021</guid><dc:creator>GL</dc:creator><description>Hi there,&lt;br&gt;I am trying to get FXCop to analyze one of our bigger and more advanced projects. I am now running into trouble that more than half the files can either not be opened be FXCop or FXCop can open them but crashes. In the project we have to interact with non managed code, is that one of the reasons why this happens? In addition I ran PEVerify and there I also get some IL errors?! I am not sure why, becuase I can open the assembly fine with the ILDASM tool.&lt;br&gt;Since I was reading that MS is using FXCop over all products I was wondering if you hear a lot about prblems like that or if this is an isolated case. Also as I understand in the next version FXCop will use a new IL parser, will that address that problem? &lt;br&gt;</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#49095</link><pubDate>Fri, 09 Jan 2004 17:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49095</guid><dc:creator>Jeffrey van Gogh</dc:creator><description>Hi GL,&lt;br&gt;&lt;br&gt;Sorry to hear you're having such problems using FxCop. Can you contact us via email: asfxcop AT Microsoft.com so we can help you resolve this issue? Things we would like to know:&lt;br&gt;&lt;br&gt;-What errors are you seeing?&lt;br&gt;-What language did you use to build this assembly?&lt;br&gt;-What errors did PEVerify show?&lt;br&gt;-What version of the framework did you use to compile your assembly with, is FxCop running on that same version (See Help about to check which version FxCop is running on).&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;&lt;br&gt;&lt;br&gt;Jeffrey van Gogh&lt;br&gt;FxCop Team</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#49096</link><pubDate>Fri, 09 Jan 2004 17:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49096</guid><dc:creator>Jeffrey van Gogh</dc:creator><description>That address should ofcourse be: asKfxcop At Microsoft.com</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#49248</link><pubDate>Fri, 09 Jan 2004 23:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49248</guid><dc:creator>Eric Newton</dc:creator><description>people relax... fxcop is a design GUIDELINES check, not neccesarily a code-correctness check.&lt;br&gt;&lt;br&gt;If System.dll had 1600 true errors, do you think we'd be happy go-lucky .Net developers? or raging lunatics bent on hair pulling...&lt;br&gt;&lt;br&gt;again, relax</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#49279</link><pubDate>Sat, 10 Jan 2004 01:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:49279</guid><dc:creator>Jeffrey van Gogh</dc:creator><description>Hi Eric,&lt;br&gt;&lt;br&gt;FxCop does check both Design Guidelines, as well as Code-correctness issues, the ratio is about 50%-50%. You're right though that most of the issues in System.dll are Design Guidelines violations.&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;&lt;br&gt;&lt;br&gt;Jeffrey van Gogh&lt;br&gt;FxCop Team</description></item><item><title>FAQ: Why does FxCop generate violations against itself? [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#70937</link><pubDate>Wed, 11 Feb 2004 02:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:70937</guid><dc:creator>FxCop</dc:creator><description /></item><item><title>Why does FxCop generate violations against itself?</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#71136</link><pubDate>Wed, 11 Feb 2004 09:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:71136</guid><dc:creator>overflow</dc:creator><description /></item><item><title>Design Guidelines</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#162557</link><pubDate>Tue, 22 Jun 2004 16:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162557</guid><dc:creator>Vinod</dc:creator><description>I have a specific design rule to check in my Presentation Layer. I have to check whether any one of the development team has mistakenly created an Instance of DataAccessHelper in the Web Layer. I should be able to check even within a method whether an Instance of the DAL is created. How is it possible to write a Custom rule for such situations using FxCop?&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;&lt;br&gt;Vinod</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#162746</link><pubDate>Tue, 22 Jun 2004 19:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162746</guid><dc:creator>Jeffrey van Gogh</dc:creator><description>Hi Vinod,&lt;br&gt;&lt;br&gt;first I'd recommend to take a look at this article from MSDN Magazine: &lt;a target="_new" href="http://msdn.microsoft.com/msdnmag/issues/04/06/Bugslayer/default.aspx"&gt;http://msdn.microsoft.com/msdnmag/issues/04/06/Bugslayer/default.aspx&lt;/a&gt; It talks about how to write custom fxcop rules.&lt;br&gt;&lt;br&gt;Then about your specific question. I'd walk the Method.Instructions and see if you find a instruction with OpCode.Newobj that has a value that is a InstanceInitailizer of the DataAccessHelper type.&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;&lt;br&gt;&lt;br&gt;Jeffrey</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#162774</link><pubDate>Tue, 22 Jun 2004 19:45:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:162774</guid><dc:creator>Vinod</dc:creator><description>Hi Jeffrey,&lt;br&gt;&lt;br&gt;Is it possible for you to post a sample code on the same. &lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;&lt;br&gt;Vinod</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#163065</link><pubDate>Wed, 23 Jun 2004 00:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:163065</guid><dc:creator>Jeffrey van Gogh</dc:creator><description>sure, provided you get the basic rules running from the article, here's some sample code:&lt;br&gt;&lt;br&gt;public Problem[] Check(Method method)&lt;br&gt;{&lt;br&gt;  for(int i=0; i &amp;lt; method.Instructions.Length; i++)&lt;br&gt;  {&lt;br&gt;    Instruction instruction = method.Instructions[i];&lt;br&gt;    switch(instruction.OpCode)&lt;br&gt;    {&lt;br&gt;      case OpCode.Newobj:&lt;br&gt;        InstanceInitializer cons = instruction.Value as InstanceInitializer;&lt;br&gt;        if (cons.DeclaringType == MyTypeThatIsNotAllowed)&lt;br&gt;        {&lt;br&gt;          Problems.Add(GetResolution(cons.FullName), instruction);&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;  }&lt;br&gt;  return Problems.AsArray();&lt;br&gt;}</description></item><item><title>re: Code Analysis of Microsoft Assemblies [Michael Fanning]</title><link>http://blogs.msdn.com/fxcop/archive/2004/01/08/code-analysis-of-microsoft-assemblies-michael-fanning.aspx#163374</link><pubDate>Wed, 23 Jun 2004 08:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:163374</guid><dc:creator>Vinod</dc:creator><description>Thanks a lot Jeffry. Interospection solved the issue. When will be the release for the Interospection help documentation.?&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;&lt;br&gt;Vinod</description></item></channel></rss>