Unable to cover unit tests that use Microsoft SQL Server
Problem
Running coverage for unit tests that use Microsoft SQL Server may finish with one of the following errors:
Coverage session finished with errors: Can't set event mask (COM error 0x80131377).Coverage session finished with errors: Can't profile the application because the host protection is applied. Probably it relates with Microsoft SQL Server.Cause
Microsoft SQL Server protects its process from access by profilers. If dotCover attempts to instrument the SQL Server process, the coverage session fails.
Resolution
Exclude the SQL Server process from coverage with --exclude-processes option. Sample:
dotCover cover --exclude-processes sqlservr.exe -- testFor more information, refer to the dotCover command reference.
Please sign in to leave a comment.
Is there a fix in the works for the interactive test runner?