For the complete documentation index, see llms.txt. This page is also available as Markdown.

Capturing coverage from the app process

Capture runtime coverage by wrapping the target process or by using a background listener.

There are two ways to capture coverage from application or service processes with the SeaLights .NET Agent:

  1. Run the process with the agent by using the run command.

  2. Run the agent as a background listener.

Use the background listener flow when you cannot change the original startup command.

Running the process with run

To capture coverage from a single application, start it through the agent.

.\sl-dotnet-agent\SL.DotNet.exe run --buildSessionIdFile buildSessionId.txt --labId "<lab-id>" --includeNamespace "MyCompany.*" --instrumentationMode coverage --target "C:\MyApplication\App.exe" --workingDir "C:\WorkingDir" --targetArgs "-Flag1 true"

This replaces the regular startup command for the application you want to profile.

See Command Reference for full parameter details.

Running the agent as a background listener

Use this flow when the application command must stay unchanged.

Start the background listener

Start the listener with a unique session key.

.\sl-dotnet-agent\SL.DotNet.exe startBackgroundTestListener --buildSessionIdFile buildSessionId.txt --labId "<lab-id>" --includeNamespace "MyCompany.*" --testListenerSessionKey SL_CovCollectorAgent

Set the agent as a profiler

Set these environment variables in the same session that starts the application.

Stop the background listener

When coverage collection is complete, stop the listener with the same session key.

See Command Reference for full parameter details.

Last updated

Was this helpful?