CMS Snapshot Analysis - Run Analyzer - DOTNet - Information - Analyzer does not exclude generated code


C# generated code can be recognized by the fact that the classes are using the System.CodeDOM.Compiler.GeneratedCode attribute. The generated code should be automatically be excluded from all metric results.

In the below screenshots from Enlighten, visualizing for example class RemoteConnectivityFeature which is using the GeneratedCodeAttribute and the screenshot from the Dashboard which shows the same object as violation for several rules.

Observed in CAST AIP
Observed on RDBMS
Step by Step Scenario

Packaged and delivered the source code.

Run the analysis and snapshot.

Class using GeneratedCodeAttribute showing violation for several quality rules


A class is considered as generated (not in the dashboard, no Quality Rules) if and only if all its fragment are generated.

If a class is partial and some of the fragments are attributed as generated and some are not then the class will be considered as user code and metrics and Quality Rules would be applied to this object but only to the non generated one.

Below is the code snippet which shows that the one fragment of class RemoteConnectivityFeature is attributed by GeneratedCodeAttribute but the other one is not so that's it appears in the dashboard.

If at least one of its fragment or not generated QRs and metrics computation will based on them, here is the fragment which is not considered as generated acceptancetests\features\connectivityandscreensharing\remoteconnectivity\remoteconnectivitysteps.cs

Impact on Analysis Results and Dashboard


Related Pages