none
GeneratedCodeAttribute: Difference between .NET4.5 and 4.0

    Question

  • In our application we have a problem with the GeneratedCodeAttribute in the generated code from XAML.

    When .NET Framework 4.0 is installed the whole generated class has the GeneratedCodeAttribute before the class.
    As soon as the .NET Framework 4.5 is installed the generated class does not have the attribute, but each member, property, function has this attribute. But for some fields this property is missing (mostly the private bool _contentLoaded). The project is not converted to .NET 4.5, it is still in .NET 4.0.

    Now we have problems with our own FxCop rules. As the whole class and the field _contentLoaded does not have the GeneratedCodeAttribute, it is checked with FxCop. As the field _contentLoaded does not fulfil our own FxCop rules, there will be an error.

    What could be a possible solution? An exceptional case in our own FxCop rules (e.g. if (name == _contentLoaded)...) is not our preffered solution.

    I think the GeneratedCodeAttribute is simply missing for some cases in .NET 4.5.

    Tuesday, November 27, 2012 1:40 PM

Answers

All replies