-
Notifications
You must be signed in to change notification settings - Fork 247
Service Support
Note that .zip and .nuget packages (at least) will not ACL files so that a low-privilege service can execute them -- manually add the service principal with read/execute privilege to the OpenCover.Profiler.dll ACLs, either through explorer properties or by a Get-Acl
/Set-Acl
PowerShell script.
Launching the profiling operation must be done with Administrator privilege -- this is required to even start the service, and is also needed to create the global objects and set the per-service environment that registers the COM object. Assuming that the COM objects have been pre-registered, the command line to use is like
OpenCover.console.exe -service:byname -target:<service name> -output:coverage.xml
As this is a blocking operation, launching the coverage gathering a separate process as
start-process OpenCover.console.exe @("-target:<service name>", "-service:byName", "-output:<service name>coverage.xml")
or equivalent in your test scripts.
The byname
qualifier is used to prevent races if multiple services are being started concurrently by injecting the OpenCover profiling information to the service specific environment.