DotCover ignore simple Getters and Setters in Analysis

Is there a way to get DotCover to not display simple getters and setters in its analysis?

1
2 comments

Hi Rylan,

Which version of dotCover do you use?
In the latest versions auto-implemented properties are included in a coverage report just for information, they do not have any influence on the resulting coverage percentage and do not have highlighting.

Best regards,
Fedor.

0
Avatar
Permanently deleted user

Hi Rylan,

 

You can do this by using Coverage Filters.  To do this open the Coverage Filters window and select Add filter; then select "Do not analyze code in"; leave assembly and class with the default asterisk and for method put "set_*" without the quotes.  Repeat this process and do "get_*" and once complete the code coverage will ignore the getters and setter in analysis.

After figuring this out I realized that it's not always a good idea to do this because it will also ignore getters and setters that are written in code.  For example it will ignore both of these blocks of code:

 

public string Foo { get; set; }

 

private string _bar;

public string Bar

{

    get { return _bar; }

    set {

       _bar = value;      

       // Do some custom work to modify the value of _bar

        }

}

 

Regards,

Bryan

0

Please sign in to leave a comment.