Search code examples
c++visual-studio-2019code-coverage

Visual Studio 2019 VSInstr.exe - Unable to instrument executable with excludes file


I'm performing code coverage on an application using the Visual Studio 2019 instrumentation tool (VSInstr.exe).

In the command prompt (run as admin), I run "vsinstr.exe -coverage ApplicationName.exe @ExcludeList.txt". The result should be an instrumented .exe and .pdb file with the appropriate libraries and functions excluded, but it always fails with an error: "Unable to backup original file".

The problem is apparently in the excludes list text file, as it runs fine without @ExcludeList.txt. I've looked through the excludes list and made sure none of the exclude statements had any syntax problems. The file is formatted correctly, with no other statements or blank lines, and there are no access restrictions on it.

The executable was built with the Linker profile switch set to 'Yes' (Project => Linker => Advanced => Profile), so it is instrumentable. The .exe, .pdb, and the excludes list text file, ExcludeList.txt, are all in the same directory.

What could be the issue?


Solution

  • I just used vsinstr.legacy.exe for now - it seems to do the job just as well as the normal one does.