# Opencover exclude by attibute syntax

**URL:** <https://www.finalbuilder.com/forums/t/opencover-exclude-by-attibute-syntax/5306>\
**Category:** Discussion\
**Created:** [January 28, 2015, 2:05am UTC](https://www.finalbuilder.com/forums/t/opencover-exclude-by-attibute-syntax/5306 "2015-01-28T02:05:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbrejner](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/c5a1d2/32.png) [@jbrejner](https://www.finalbuilder.com/forums/u/jbrejner)\
**Post date:** [January 28, 2015, 2:05am UTC](https://www.finalbuilder.com/forums/t/opencover-exclude-by-attibute-syntax/5306/1 "2015-01-28T02:05:44Z")

</div>

Hi.  
  
In my OpenCover Action I added a filter like this  
_ExcludeFromCodeCoverage_   
which - to my knowledge properly excludes parts of code where this attribute  
[ExcludeFromCodeCoverage]  
has been set.  
  
Now we also use CodeContracts, which adds an attribute like this  
[ContractClassFor(typeof(IToneTest))]   
  
but if I add this line  
_ContractClassFor_  
  
to the filter dialog, I do not see the expected change in coverage.  
  
So my question is; if “_ContractClassFor_” is the correct syntax for excluding attributes like “[ContractClassFor(typeof(IToneTest))]” ?  
  
Best regards

---

<div class="post-metadata">

**Author:** ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)\
**Post date:** [January 30, 2015, 2:11am UTC](https://www.finalbuilder.com/forums/t/opencover-exclude-by-attibute-syntax/5306/2 "2015-01-30T02:11:22Z")

</div>

Hi Jens,  
  
The syntax seems to be correct according to the OpenCover documentation. Continua CI just sends the parameters you supply to OpenCover.Console.exe - you can see the full command line in the build log.  
  
I created a dummy project to test this and although I can get OpenCover&nbsp;to skip several different attributes, I cannot get it to skip the&nbsp;ContractClassFor attribute.   
  
I’m not sure why this is. There seems to be a bug or oddity with the way that OpenCover excludes attributes. You will need to open an issue with OpenCover&nbsp;providing them with the command line parameters from the build log and your class details.
