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.