dotcover showing 0% coverage despite tests running through code


I logged this on SO here ( but no one has answered yet

I'm assuming this is an error on my part but I can't figure out why ReSharper dotcover is showing my test coverage of certain queries (and commands too) as 0%.

So I have a .NET Core CQRS API that is made up of a lot of EF Core LINQ. Below is a simple example of one of my queries's main execute method (I left out the DI constructor but I'm sure you git the idea):

    public bool Execute(SelectIsReportRequested query)
         var context = _clientDatabase.GetContext(query.DatabaseId);

         var result = (from a in context.Assessments
                       join r in context.Registrations on a.AssessmentId equals r.AssessmentId
                       where a.PublicId == query.ResponseId
                       select r.ReportRequested).SingleOrDefault();

         return result == 1;

Then I have the following test that mocks the various bits and runs the query:

    public void It_should_return_true_if_a_report_has_been_requested_for_the_givenassessment()
        const int assessmentId = 1;
        var responseId = Guid.NewGuid();
        var mockRepository = new Mock<ICViewClientContext>();

        var assessments = new List<Assessments>
            new Assessments { AssessmentId = assessmentId, PublicId = responseId },
         var registrations = new List<Registrations>
            new Registrations { AssessmentId = assessmentId, ReportRequested = 1 },

         mockRepository.Setup(x => x.Registrations).Returns(registrations.AsDbSetMock().Object);
         mockRepository.Setup(x => x.Assessments).Returns(assessments.AsDbSetMock().Object);

         var mockClientDatabase = new Mock<IClientDatabase>();
         mockClientDatabase.Setup(x => x.GetContext(1)).Returns(mockRepository.Object);

         var query = new Queries.Assessments.SelectIsReportRequested(2, responseId);
         var handler = new Queries.Assessments.SelectIsReportRequestedHandler(mockClientDatabase.Object);
         var result = handler.Execute(query);

         Assert.AreEqual(true, result);

The tests passes (and will also fail if I break the logic in the LINQ) or any other logic in the code.

However, running dotcover runs the test, passes it but says that none of it is covered.

I would love to know why because it's really driving me insane and worries me that I've done something completely wrong!


So unbelievably the problem has now gone away! I think it might have been when I was trying to get the logs and unchecked 'use preloaded unit test runners'. I then saved it...thought twice about it...went back and re-checked it and saved it again. And through this fumbling I seem to have fixed it! Does that sound like it might have solve some weird error? I had been experiencing the issue for over a month so I know it wasn't just a one time thing.


Hi Ben,

Great to hear that now it works fine for you!
I could hardly see any connection between 'use preloaded unit test runners' setting and the problem. The only thing that comes to my mind is that somehow ReSharper settings were corrupted on your machine and after these manipulations, they came into the normal state.


I had the same problem. Zero test coverage showing. Disable and re-enable that setting (based on what you're saying, possibly any setting) and it works. 


Hi I have the same problem , dotCover doesn't work at all. i tried on projects .net 3.1 , .net 6 and .net 7 .

Im clicking this one 


What I tried :

1. Delete cache from File/Invalidate Caches

2. Enable Highlighting form dotCover/Highlighting 






Look at Unit Test windows tool:

and be ensured that there is no Off in part Continuous testing model selector:


Dradkov , please check at Project Properties, that debug symbols are enabled and are the type of “Portable” 


I had the same problem. V Kaluhins post was very helpful but wasn't enough to fix my problem. I needed to select Cover New and Outdated Tests and then in the appearing popup click yes. I needed to repeat the process when new tests where added


Dradkov, could you share an update? Did any of the suggested workarounds help in your case? If the issue persists, please collect dotCover logs and submit a support request

V Kaluhin, though continuous testing is a part of dotCover functionality, there can't be a connection between continuous testing mode and Cover All Tests failing to collect\display any coverage results. Do you experience any issues, and this kind of workaround helps?


Tina Loock, Do I get you right that Cover All Tests also does not work for you? And if so, does only resetting continuous testing modes help to collect the coverage?  Btw, continuous testing has triggers configuration at File | Settings | Build, Execution, Deployment | Unit Testing | Continuous Testing where you can select an action to launch continuous testing: on save, on build, on hotkey. Also, clicking Yes on the provided modal window calls absolutely the same action Cover All Tests from Solution, which you can also find in the Unit Tests Explorer\Session window in the drop-down menu under Run Test\Run All Tests buttons.


Please sign in to leave a comment.