Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6980337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:00:12+00:00 2026-05-27T18:00:12+00:00

I am using Visual Stdio 2010 and its testing and code coverage features, and

  • 0

I am using Visual Stdio 2010 and its testing and code coverage features, and I have a bunch of generated code that I don’t want to be included in code coverage results. These are generated as partial classes.

I’ve read in a few places (example: How to ignore generated code from code coverage data) how I can have the code coverage tools ignore the entire class or specific members using attributes. So I’ve modified the generator to include the [ExcludeFromCodeCoverage] attribute on all of the classes it generates, but that prevents the code I write in partials from being tracked for code coverage as well.

How can I set things up such that code I manually write in partials are included in the code coverage results, but the generated code is not? The only option I am seeing now is to dig into the generator (a long, ugly T4 template) and add the [ExcludeFromCodeCoverage] attribute at the property/method level instead of at the class level. Is there another way? I haven’t seen anything like [IncludeFromCodeCoverage] that I could add to my handful of properties/methods hand-written in partials to include those while ignoring the rest of the auto-generated class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:00:12+00:00Added an answer on May 27, 2026 at 6:00 pm

    You are not alone in requesting this as this entry on ExcludeFromCodeCoverage and other How to ignore generated code from code coverage data shows.

    The other way I have seen this done with some other (eg ncover, partcover) coverage tools is to post process the results ie if XML use an xslt transform the xml to remove the coverage data related to the generated partials and then generate the coverage report.

    You may be able to apply this approach or something similar as it looks like you can get access to the coverage data in XML.

    OpenCover has a file filter that allows you to exclude all methods in a file that matches the filters, created for just this scenario as the names of generated files tend to follow known patterns, it also allows more than one filter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have recently started using Visual studio 2010 ,so I'm unaware of its various
I have a Setup project that I have build using Visual Studio 2010. The
I have a Setup Project that I made using Visual Studio 2010. The application
I'm using Visual Studio 2010 RC. Would it be possible that after doing my
i am using visual studio 2010. i have a three dimensional structure array which,
I have compiled this using Visual Studio 2010 compiler and it has compiler error
My scenario I'm using Visual Studio 2010 with Entity Framework 4.1 I have a
I wrote an application that installs using the Visual Studio 2010 Setup Project. As
I have issues setting up my deployment project in Visual Studio 2010. Im using
I am using Visual Studio 2010 for an MVC website project. I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.