Cant apply coverage exclusion attrib. to method
Cant apply coverage exclusion attrib. to method
When I apply an exclusion attribute to a method in NCover, then view the report in NCoverExplorer all the sequence points in the method are reported as 0% coverage instead of being excluded completely.
Am I misunderstanding this ? I think I have a pretty simple example, basically something like this:
[AttributeUsage(AttributeTargets.All)]
internal sealed class CoverageExcludeAttribute : Attribute { }
class Test
{
[CoverageExclude]
private void LoadState()
{
...
}
}
The XML generated by NCover looks something like this:
<method name="Foo" signature="Foo() : void" excluded="true" instrumented="false">
<seqpnt vc="0" l="67" el="67" c="13" ec="67" ex="false" fl="65536" doc="1" />
<seqpnt vc="0" l="0" el="0" c="0" ec="0" ex="false" fl="131072" doc="0" />
</method>
Note the excluded="true" attribute in but also note the ex="false" attribute in the individual ? Are these contradictory ? (I'm assuming ex means excluded - if I manually change the ex attributes of the sqpnt's to true I get the behavior I expected)
I'm doing all this via the MSBuild task, everything else is working great (I love the product!), I can successfully exclude by type or file using the other NCover parameters, but I just can't seem to get the exclusion attribute doing what I expect.
Thanks in advance for any advice ! - Jake
RE: Cant apply coverage exclusion attrib. to metho
Oops, looks like your forum software doesn't escape markup correctly (and I didn't read the formatting guide!)... here is small sample of the coverage xml file with markup angle brackets replaced with square brackets:
[method name="Foo" signature="LoadState() : void" excluded="true" instrumented="false"] [seqpnt vc="0" l="66" el="66" c="9" ec="10" ex="false" fl="65793" doc="1" /] [seqpnt vc="0" l="67" el="67" c="13" ec="67" ex="false" fl="65536" doc="1" /] [/method]
Again, note the excluded="true" and ex="false" attributes
RE: Cant apply coverage exclusion attrib. to method
Jake,
you are correct, this is a bug in the exclusion attribute implementation. I've created a support ticket for it, which you can see here: https://gnoso.fogbugz.com/default.asp?461
We're busy preparing for the 2.0.3 release now, so if we can't fix this in the 2.0.3 release, we'll fix it in the next.
Regards, Stepehn Ward
RE: Cant apply coverage exclusion attrib. to metho
Great. Thanks for the update.
Good job on a great product.
- Jake
RE: Cant apply coverage exclusion attrib. to method
Stepehn,
I tried to view the bug, but I need the case number, not the bug number.
I have a FogBugz account, just not on your domain.
Thanks
Joe