Just installed 1.39b and tried NCrunch Metrics. It doesn't seem to be respecting the ExcludeFromCodeCoverage attribute.
Daily Usage Issues
Code Coverage not respecting ExcludeFromCodeCoverage
Started by greba on 16,373 views
Remco NCrunch Developer
#1884
16 May 2012 23:20 UTC
NCrunch uses a different mechanism for handling and excluding code coverage, so framework-specific attributes such as this one are not supported by the metrics view. If you wish to avoid aggregating metrics from certain areas of your source code, currently the only way to do this is to use the 'Exclude from metrics aggregation' option on the metrics view toolbar or via the context menu option.
Cheers,
Remco
Cheers,
Remco
Understood.
Is this the appropriate place to make a feature request? Support for ExcludeFromCodeCoverage would be beneficial.
Remco NCrunch Developer
#2091
05 Jun 2012 21:42 UTC
Thanks - many people are asking for this, so it looks like it will eventually be implemented :)
Bump. Any word on when this feature might be delivered?
Remco NCrunch Developer
#3830
10 Mar 2013 08:08 UTC
Hi,
I can't give any firm plans on when this will be added. It may be in the 1.45 release, although I recommend not holding out for it. For the time being, try using code coverage suppression instead.
Cheers,
Remco
I can't give any firm plans on when this will be added. It may be in the 1.45 release, although I recommend not holding out for it. For the time being, try using code coverage suppression instead.
Cheers,
Remco
Remco NCrunch Developer
#3915
30 Mar 2013 22:19 UTC
For anyone interested, support for the ExcludeFromCodeCoverage attribute has been introduced with the newly released version of NCrunch (v1.45).
Hello, looks like ExcludeFromCodeCoverage attribute is supported only for AttributeTargets.Class. Attributing methods does not have any effect on NCrunch.
Remco NCrunch Developer
#6004
11 Jun 2014 22:44 UTC
NCrunch does support this attribute at method level, but be aware that methods containing the following will likely be unaffected by the attribute:
- Lambda expressions (contents of lambda will still be shown with code coverage)
- Yield return (iterator) methods
- ASync/Await methods
This is due to the inherent limitations of using an attribute to restrict code coverage data. This attribute doesn't get passed on by the compiler to any structures it generates to deal with the above situations. All code coverage tools that use the ExcludeFromCodeCoverage attribute encounter this problem, including MSTest (for which it was originally intended).
I recommend avoiding the use of this attribute. NCrunch's code coverage suppression comments leave less of a mark on the compiled code and are not subject to the above limitations.
- Lambda expressions (contents of lambda will still be shown with code coverage)
- Yield return (iterator) methods
- ASync/Await methods
This is due to the inherent limitations of using an attribute to restrict code coverage data. This attribute doesn't get passed on by the compiler to any structures it generates to deal with the above situations. All code coverage tools that use the ExcludeFromCodeCoverage attribute encounter this problem, including MSTest (for which it was originally intended).
I recommend avoiding the use of this attribute. NCrunch's code coverage suppression comments leave less of a mark on the compiled code and are not subject to the above limitations.
Post a reply
Log in to reply.