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; }
}
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."
Most helpful comment
Feedback: Don't add the new ctor. Instead add a get+set property
string? Justification. This mirrors theSuppressMessageAttributedesign.