opencover icon indicating copy to clipboard operation
opencover copied to clipboard

Improve error message when execute permissions are missing

Open sharwell opened this issue 8 years ago • 1 comments

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

My Framework

  • [x] .NET 4.5

My Environment

  • [x] Windows 7 or below (not truly supported due to EOL)

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

  • [x] no coverage being recorded
  • [ ] 32 or 64 bit support
  • [x] feature request

Expected Behavior

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

  • Detect that OpenCover.Profiler.dll does not have execute permissions for the current user, and report a specific error message in this case.
  • In the event that register fails with error code 3 (I believe this is the :3 in the current message) and the profiler DLL exists, update the error message to alert the user that the file may not have execute permissions for the current user.

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

sharwell avatar Mar 11 '17 19:03 sharwell

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.

SteveGilham avatar Sep 03 '17 17:09 SteveGilham