Search

MSDataSetGenerator does not add [GeneratedCodeAttribute] correctly by TheSource1

Closed
as Fixed Help for as Fixed

4
Sign in to vote
0
Sign in to vote
Sign in
to vote
Type: Bug
ID: 349243
Opened: 6/4/2008 5:02:50 AM
Access Restriction: Public
1
Workaround(s)
1
User(s) can reproduce this bug
MSDataSetGenerator does not follow guidelines for adding the [GeneratedCodeAttribute] and puts the attribute at class type level for TableAdapters, which is a partial class. Because of this code metrics are calculated incorrectly because, although generated, it still takes into account the properties of the class (getters and setters)....

Filed here because of this blog post:
http://blogs.msdn.com/fxcop/archive/2007/04/27/correct-usage-of-the-compilergeneratedattribute-and-the-generatedcodeattribute.aspx
Details (expand)
Product Language
English

Version

Visual Studio 2008 (All Products and Editions)
Operating System
Windows XP Professional
Operating System Language
English
Steps to Reproduce
create project with tableadapter
write unit tests for the project
check code coverage for generated tableadapter code
Actual Results
getters and setters are coloured according to being 'hit' or not (red or blue) while methods are not
Expected Results
should not be coloured at all (= no code coverage because all code is generated)
TAP Code (if applicable)
 
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey. [Details]

 

File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 6/5/2008 at 1:19 AM
Thanks for reporting the issue.

In order to fix the issue, we must first reproduce the issue in our labs. I am unable to reproduce the issue with the steps you provided.

Could you please upload a zipped project and a screenshot aobut the issue to help us reproduce it?

Thanks again for your efforts and we look forward to hearing from you.
Visual Studio Product Team
Posted by Microsoft on 10/2/2008 at 12:54 PM
Hello,

We've looked at this issue and determined not to fix it for the next release of Visual Studio. Although we understand adding GeneratedCodeAttribute would clean up code coverage result, we are more worried about bloating the generated code since we need to attribute every member.

Please do not hesitate to let us know if you have further suggestions or issues.

Thanks!

Young Joo
Program Manager
Visual Studio
Posted by OsirisTerje on 11/5/2008 at 7:22 PM
To me it would seem more wrong to not fix this issue due to a fear of further bloating. The increase in bloating here is minimal, and doesn't pose any problems, compared to the problems by having Code Metrics, Code Analysis and Code Coverage giving incorrect results. Generated code should NOT be part of these analysises.
Posted by Microsoft on 1/7/2009 at 10:38 AM
Hello,

Team reviewed this bug again and have decided to fix it since it seems to be impacting larger number of developers. Note that we do currently have GeneratedCodeAttribute at the class level for Typed Dataset. However, it is not the right place to have this attribute on. Having the GeneratedCodeAttribute on the class level for partial classes would even make the user's partial class implementation be skipped which is not the right behavior. We will be adding the attribute at the member level so that the code analysis tool does the right thing.

Thanks!

Young Joo
Program Manager
Visual Studio
Posted by Microsoft on 2/24/2009 at 9:35 PM
Hi there,

We have recently fixed this issue. It will be available in the next release of Visual Studio.

Let us know if you have further suggestions.

Thanks,
Visual Studio Product Team
Posted by Martin Moe on 4/2/2009 at 2:35 AM
Nice :-)