For example - in VB.NET the MySettings-class is generated for each assembly that is created. The code in it is automatically generated and you shouldn't change it (it even says so in a comment from the tool...). However it is counted when the code coverage result is calculated.
The same thing applies for proxy-classes to web services for example.
This gives an incorrect picture on how much of your code that is tested. But now I've found an attribute that might help:
Works like a charm. Watch out though - since the attribute applies for debugging also you will not be able to step into the code. For the examples I've counted (MySetting and proxy classes) that is normally not a problem, but if you need to you might want to reconsider.
Here is the article that pointed me the right way.
Published byon Last updated