What should go in the “Function mask” field in dotCover’s “Edit Coverage Filter” dialog? I’ve tried “Foo” and “Foo*” with no effect.
example:
public class Foo
{
public Foo(int x, int y)
{
// how can I exclude this code from the code coverage calculation?
}
...
}
First of all, it’s worth mentioning that dotCover analyses complied assemblies, not the source code, to generate its coverage reports. Any C# constructor (irrespective of its name in C#) is compiled into a method named
.ctor(or.cctorif the constructor is static). That’s why dotCover will never see a method calledFoo(int, int)in your example.If you want to filter out the constructors of the
Fooclass, you need to type the following in “Edit Coverage Filter” dialog:Foo.ctorHope this helps.