1

Closed

Decorate generated class with GeneratedCodeAttribute

description

Decorate generated class with GeneratedCodeAttribute to avoid CodeAnalysis errors.
Closed Apr 29, 2010 at 9:29 AM by alexschrod
Suggested implementation goes against guidelines of the attribute.

comments

alexschrod wrote Apr 24, 2010 at 1:39 AM

Resolved with changeset 31948



** Closed by alexschrod 07/12/2009 15:30

TheRHCP wrote Apr 24, 2010 at 1:39 AM

Only class code elements are decorated with the attribute but not the class itself.

TheRHCP wrote Apr 24, 2010 at 1:51 AM

I uploaded the patch to allow classes decoration.
The first I uploaded was wrong, please remove it. Thanks.

alexschrod wrote Apr 24, 2010 at 6:21 AM

The code generator generates partial classes. They can be modified and expanded in other files. Microsoft's guidelines say that classes of this kind should not be decorated with that attribute, as not all code in them is necessarily generated.

TheRHCP wrote Apr 25, 2010 at 6:20 PM

I did not thought about this, it is indeed a good guideline to follow. It would break the sense of the attribute.

However I assume that a lot of projects are not going to expand these classes in other files. Maybe you could add setting in DSL allowing to workaround this rule.

If you do not think it is a good alternative, let's close this Work Item so I keep going with the patch as I really need it. FxCop is so straight!

andym1978 wrote Jul 5, 2011 at 5:07 PM

In the patches section, please ignore the "Approved" status.