Runtime: API Addition: `ExcludeFromCodeCoverageAttribute(string reason)`

Created on 6 Apr 2019  路  8Comments  路  Source: dotnet/runtime

Frequently I want to add a reason why something is excluded from code coverage. In the vein of the Justification property of SurpressMessageAttribute, maybe this addition would be useful:

public class ExcludeFromCodeCoverageAttribute
{
        public ExcludeFromCodeCoverageAttribute();
        public ExcludeFromCodeCoverageAttribute(string reason);

        public string Reason { get; set; }
}
api-approved area-System.Diagnostics

Most helpful comment

Feedback: Don't add the new ctor. Instead add a get+set property string? Justification. This mirrors the SuppressMessageAttribute design.

All 8 comments

Would this attribute be in the binary you deploy with your app (ie ship to customers)? That seems undesirable. Perhaps you would conditionally define it so it didn't?

Feedback: Don't add the new ctor. Instead add a get+set property string? Justification. This mirrors the SuppressMessageAttribute design.

@hughbe any interest in taking this one?

@terrajobst, this is marked api-approved. What is the approved design?

@terrajobst, this is marked api-approved. What is the approved design?

Can't tell. This issue was approved before I started to explicitly put comments on everything we approved. I assume we thought the design as outlined in the description was sufficient to approve.

Ok. In #38520 I merged just adding a string? Justification property, per https://github.com/dotnet/runtime/issues/29185#issuecomment-571726362

Makes sense. We probably didn't consider the suppress message attribute.

Yes, sorry. That was unclear in my comment. This came through API review on Jan 7, and the feedback was "approved, but instead of using a new constructor parameter add an optional _Justification_ property to match _SuppressMessageAttribute_'s shape."

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  230Comments

galvesribeiro picture galvesribeiro  路  185Comments

ebickle picture ebickle  路  318Comments

ericstj picture ericstj  路  152Comments

syeshchenko picture syeshchenko  路  199Comments