Hello @Levina Lioe ,
Welcome to Microsoft Q&A forum.
Please first try to create a new Unit Test project and run code coverage directly. Verify if the same error appears.
If the same error appears, please try to repair Visual Studio(VS Installer => More => Repair) and reset Visual Studio settings(open Developer Command Prompt for VS 2019 Enterprise => run devenv /ResetSettings
).
If the Code Coverage runs successfully, please check if your project linked any references, used any references, and set any configurations. Make sure that all necessary dll/output files have been copied to the correct folder/output folder.
Also, please verify that for each assembly, there’s .pdb file in the same directory(typicall bin\debug) as the .dll or .exe file. If you are using C++ project, verify that Linker => Debugging => Generate Debug Info is set to Generate Debug Information optimized for sharing and publishing (/DEBUG:FULL).
Besides, was building and running the unit test project successfully passed?
Please feel free to let us know the result.
Sincerely,
Tianyu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.