coverlet
coverlet copied to clipboard
ExcludeByAttribute obsolete excludes ref-struct
Admittedly I could just not exclude obsolete attributes but basically, a ref-struct actually has an obsolete intentionally added by the compiler.
Here is an example of a recently compiled code that I intentionally decompiled to find this "hidden" obsolete attribute.

Microsoft has documentation about it and why it is there too: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-7.2/span-safety#metadata-representation-or-ref-like-structs
Is there a way that coverlet could exclude obsolete without excluding ref-struct? Ideally in a way that doesn't require hard coding the files in the runsettings config.
I'm happy to try making a fix for this - haven't dug into any of the code though to see how I would go about it (plus want to know how you'd want it done - if you want it at all).
I figure I could check if "IsByRefLike" attribute is also configured and then prevent it being excluded or something.
Thanks for reporting this, mmm not great that "alternative" for us. Need to think a bit about it. Because if after I want to really exclude obsolete also on this types, it would be a problem. But maybe in that case we can exclude using simple exclude and go for that specific class name.
cc: @petli @daveMueller @tonerdo
Looks like the obsolete attribute for ref types will always have a fixed message on it, that may help with allowing exclusion of actually obsolete ref-types
This issue is stale because it has been open for 3 months with no activity.