Skip to content

Post a sign if the area is off-limits

May 12, 2010

I want to begin by stating that this is not an “I’m angry at Microsoft and venting” post, so much as a “I see an opportunity for Microsoft to improve and I’m sharing how” post.  Earlier today, I posted to the MSDN Forums a discussion topic to see what others think and where Microsoft stands on the issue of producing code that conforms to their own code analysis tools – adoption among product teams seems to be spotty, so I’m curious what the Code Analysis team is doing to increase support for and adoption of these best practices.  The following is the text of my initial forum post:

Our firm is taking the plunge into code analysis with Visual Studio 2010.  We work primarily with Microsoft CRM and were excited to see the new enhancements in the CRM SDK 4.0.12, which can generate strongly-typed entities.  When I gave this a test run with a sample project and then ran code analysis, I was gobsmacked when I saw not hundreds, not thousands, but tens of thousands of warnings (25,356 to be exact, and we’re not even using the full ruleset).

If the generated code conformed to the code analysis rules, that would be fine.  If the generated code was tagged with the GeneratedCode attribute, that would also be fine.  To not follow either practice results in code that we have to either manually tag as GeneratedCode or wrap it in its own project in such a way that the code analysis tools simply ignore it, while supervising the rest of our code.

My question is: why do Microsoft product teams selectively use these tools and techniques and what can we do to change this for the better?  For example, CRM5 is coming out soon and it would be great if this functionality in the CRM5 SDK used the GeneratedCode attribute.

I believe that this code generation tool in the SDK is a huge leap forward for us as developers, but its introduction is marred by the limited support it provides for code analysis, especially when it would be so simple to include the GeneratedCode attribute.  I’d like to see generated code marked as generated code and I’m beginning my proverbial march to Washington (Redmond) to make it so.  Stay tuned to the original forum post about GeneratedCode to see if anything comes of it or to add your own $0.02.

Advertisement
One Comment leave one →
  1. May 13, 2010 11:06 am

    Upvoted :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.