Exclude Attributes to dotCover are ignored

Cross-posted on the TeamCity forum as well

I have tried to specify the exclude attributes to dotCover 2.0 in TeamCity Enterprise 7.1.2. Here is how I have specified them:

-:module=CommonUtilities;ExcludeFromCoverage

I have also tried a simple:

-:ExcludeFromCoverage

as well as

-:ExcludeFromCoverageAttribute

My custom attribute is defined as follows:


[AttributeUsage(AttributeTargets.Class |
                    AttributeTargets.Enum |
                    AttributeTargets.Interface |
                    AttributeTargets.Delegate |
                    AttributeTargets.Method |
                    AttributeTargets.Assembly)]
    public sealed class ExcludeFromCoverageAttribute : Attribute
    {
        private readonly string reason;

        public ExcludeFromCoverageAttribute(string reason)
        {
            this.reason = reason;
        }

        public ExcludeFromCoverageAttribute()
        {
            reason = "Not required for coverage computation";
        }
    }


But the classes marked as follows:


    [ExcludeFromCoverage]
    public class ABCD {...}


are still being considered for coverage. What am I missing?
1 comment

Hello Anand,

Sorry for the late reply!
Please try to use the fully qualified name of your attribute class in the filter string: -:Your.Namespace.ExcludeFromCoverage or -:module=CommonUtilities;Your.Namespace.ExcludeFromCoverage. Or you can use an asterisk (*) wildcard instead of the full namespace: -:*ExcludeFromCoverage.

Please let me know whether it helps. Best regards.

0

Please sign in to leave a comment.