TestInitialize not being called for Windows Store Unit Test Project


I'm evaluating dotCover for a Windows Store Application and I'm trying to cover some unit tests for this using an MSTest unit test project (using VS2013). In my tests I'm using a Initialize method with the TestInitialize attribute to set up some stub classes. When I try to run the "Cover Unit Tests with dotCover" the tests always fail and when I check the coverage it shows the Initialize method in pink indicating it was never run, thus causing exceptions in my unit tests.

However when I just run the unit tests normally then the Initialize method does get called and all my tests pass. I also tried a console application with a unit test project and dotCover has no problem calling the TestInitialize method there. Is there some configuration setting I'm missing so that "Cover Unit" tests will succeed in Windows Store unit test projects?


Hello Sean,

Do you work with dotCover test runner or with ReSharper test runner? You can check this here: ReSharper | Options | Tools | Unit Testing and dotCover | Options | Unit Testing.
Could you please send us a sample solution where this problem is present?

Kind regards,


I was initially using the dotCover test runner (I usually use ReSharper but it is not installed on the machine I had installed dotCover on). I also tried the MS Test test explorer and this ran the test successfully. Below is the options window I'm using for dotCover


And these were the results:

Unit Test successful Cover not successful
unittest_dotcover.png cover_dotcover.png

When the "cover unit tests" was run, the unit test Initialize method was in pink:


I've attached the sample Windows store project with this small test. Thanks for your help!


Hi Sean,

The issue http://youtrack.jetbrains.com/issue/DCVR-6889 is already fixed and the fix will be included in the next release.
Current workaround is to disable "Collect per-test information for WinStore tests" in dotCover | Options | General.

Best Regards,


That's great, thanks for your help - is there a release date for the next version?


Hi Sean,

You are welcome to try recently released dotCover 2.7.2, it contains the necessary fix: http://www.jetbrains.com/dotcover/download/index.html

Best regards.



I seem to have the exact same issue happening with dotCover 2017.2.2 and an ASP.NET Core on .NET Core 2.0 project being tested by a .NET Core 2.0 project Running MSTest.TestFramework 1.2. I have several classes that inherit from a class with a method decorated with TestinitializeAttribute. If I run the tests wihout coverage the tests pass. If I run the tests with code coverage they give me NullReferenceExceptions for the object that my TestInitialize method sets.


Hello Justin,

Could you please try to use just released dotCover 2017.3? The issue should have been fixed there.


Please sign in to leave a comment.