microsoft / codecoverage

MIT License
73 stars 12 forks source link

Is dotnet-coverage able to track an IIS Service? #115

Open MahiFaiyaz opened 3 months ago

MahiFaiyaz commented 3 months ago

While I am getting all code coverage of my .NET services, it does not seem to track any API calls made through the IIS service. Does this tool support code coverage for IIS services?

jakubch1 commented 3 months ago

It is possible. You need to do something similar to: https://github.com/microsoft/codecoverage/blob/main/samples/Calculator/scenarios/scenario10/README.md

  1. Invoke instrument command for all dlls which are part of IIS service (with some session id)
  2. Start dotnet-coverage in server mode specifying same session id as in 1.
  3. Start IIS server
  4. Run tests
  5. Stop dotnet-coverage from 2.

Instrumented dlls will be communicating with dotnet-coverage server using shared memory and pipes so you can still see some issues related to security. Try to make sure for example that both IIS server and coverage collection are running as same user.