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

  • Home
  • SEARCH
  • 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 8460987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:45:23+00:00 2026-06-10T13:45:23+00:00

When you run tests in Visual Studio (with activated CodeCoverage) the code is highlighted

  • 0

When you run tests in Visual Studio (with activated CodeCoverage) the code is highlighted to show which parts of code have been executed and which not.

There are three different kinds of highlighting, Not Touched Area, Touched Area and Partially Touched Area. The following two pseudo codes shows examples in which the code will be partially touched.

if (true || false)

if (false && true)

However, when I run tests I wonder about the highlighting of my code. The blue background indicates that the code has been completely touched, while the dark orange indicates that the code has been partially touched. (The highlight on the last line is current line)

enter image description here

This does not make sense at all. Since the if statement is built up of a logical AND operation it must be completely touched to enter the code for the true statement.

I reckon this is a bug, however, I just wanna be clear that I don’t have any misconceptions. Do you see any reason why the if-statement can be partially touched, and though the true statement be raised?

  • 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-06-10T13:45:25+00:00Added an answer on June 10, 2026 at 1:45 pm

    My guess is that it is because the if body has never been skipped due to the test variable being true. A conditional and is compiled down to something similar to

    if (!test)
        goto afterBody;  // 1
    if (!(dummy != null))
        goto afterBody;  // 2
    // body
    afterBody:
    // next statement
    

    The line marked with 1 is never executed, hence your partial coverage.

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

Sidebar

Related Questions

In Visual Studio 2010, I have a number of unit tests. When I run
I have set of Visual Studio solutions which have unit tests. I want to
Even when Visual Studio 2010 does not run tests in multiple parallel threads, it
Can I run nUnit tests in Visual Studio (for instance)?
When I run my MSTest tests in Visual Studio 2008 Team System and get
I'm currently investigating my options to run automated tests from within Visual Studio 2008
I am writing some unit tests in Visual Studio 2010. I can run all
I have some unit-tests within a Visual Studio project with the attributes: [TestMethod] [ExpectedException(typeof(..Exception))]
We are using Visual Studio 2008. We have a solution with ca. 1000 tests.
I have an issue running some moles tests within Visual Studio 2010. Within a

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.