Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow [ExcludeFromCodeCoverageAttribute] to be used on assembly level #1050

Closed
abatishchev opened this issue Sep 7, 2017 · 5 comments
Closed

Comments

@abatishchev
Copy link

abatishchev commented Sep 7, 2017

(Migrated from microsoft/testfx#248, hope this is the right place to ask this time).

Since this attribute has the following signature:

[AttributeUsageAttribute
    (AttributeTargets.Class |
     AttributeTargets.Struct |
     AttributeTargets.Constructor |
     AttributeTargets.Method |
     AttributeTargets.Property |
     AttributeTargets.Event,
     Inherited = false, AllowMultiple = false)]
public sealed class ExcludeFromCodeCoverageAttribute : Attribute

one can't use it to annotate whole assembly, effectively making it inconvenient and rarely used. And ends up messing up with Run Settings.

@pvlakshm
Copy link
Contributor

Indeed, the attribute cannot be applied at the assembly level. That idea is being tracked here: corefx #14488.

You can already exclude assemblies from participating via a .runsettings file. See here for details: MSDN: Customizing Code Coverage Analysis.

@devlie
Copy link
Member

devlie commented Mar 25, 2022

@pvlakshm The attribute can now be specified at assembly level, but seems like VSTest still has not respected it yet. Is there any plan to enable that?

@Evangelink
Copy link
Member

Reopening the issue as assembly level is not yet supported.

@fhnaseer
Copy link
Member

fhnaseer commented May 24, 2022

It seems like this attribute is not supported at assembly level for .net framework but is supported for .net core. https://source.dot.net/#System.Private.CoreLib/ExcludeFromCodeCoverageAttribute.cs,b968c01782a640bc. Need to see if code coverage is disabled for .net core projects when this attribute is used.

@Evangelink
Copy link
Member

Sorry I have been reading things too quickly... This one was correctly fixed, I should be transferring the related issue from testfx to this repo instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants