OpenCover / opencover

A code coverage tool for .NET 2 and above (WINDOWS OS only), support for 32 and 64 processes with both branch and sequence points
https://blog.many-monkeys.com
Other
1.31k stars 248 forks source link

Improve error message when execute permissions are missing #665

Open sharwell opened 7 years ago

sharwell commented 7 years ago

Please provide the following information when submitting an issue, where appropriate replace the [ ] with a [X]

My Framework

My Environment

My issue is related to (check only those which apply):

Expected Behavior

It would be helpful if one of the following was used to alert the user to the problem:

Actual Behavior

A message like the following is reported:

Failed to register(user:True,register:True,is64:False):3 the profiler assembly; you may want to look into permissions or using the -register:user option instead. C:\windows\system32\regsvr32.exe /s  /n /i:user "D:\packages\OpenCover.4.6.519\tools\x86\OpenCover.Profiler.dll"

If the indicated regsvr32.exe command is run from the command line, it exits with code 3.

Steps to reproduce the problem:

Remove execute permissions for the current user from OpenCover.Profiler.dll. Then run OpenCover.Console.exe with the -register:user argument.

This situation is similar to the way our Jenkins server is configured. Our NuGet packages are included in Git (sigh), and if the file does not have the execute bit set in Git then the ACLs are automatically set when the file is checked out to not allow the build user on Windows to execute the file. After many trial-and-error attempts, fixing this error required us to use the following:

git update-index --chmod +x packages/OpenCover.4.6.519/tools/x86/OpenCover.Profiler.dll
SteveGilham commented 7 years ago

Related : when gathering coverage data for services, the service account needs to have read/execute rights to the profiler DLL as well. The symptom in that case is that no coverage is recorded -- no assemblies at all in the files.