I am using TeamCity with NCover integration and we want to exclude anonymous types from our code coverage reports. Is this possible? I've searched through the documentation and can't not find any mention of how or if this can be done.
You could use the fact that they are attributed with the CompilerGeneratedAttribute and exclude them, however this has the bad side effect of also excluding the expression in lambdas and possibly several other things.
//ea "System.Runtime.CompilerServices.CompilerGeneratedAttribute"
In our NCover setup we exclude code attributed with GeneratedCodeAttribute, but nothing else as we couldn't find a reliable way of determining those types. At the end of the day, anonymous types are very easy to cover if you have at least a single unit test on that code.