Profile .NET Process
dotTrace can automatically attach to and profile any .NET process that is started after you run a profiling session.
To profile a .NET process
Run dotTrace as a standalone application. The dotTrace Home window will open.
Add a run configuration - the configuration that tells dotTrace how to run the profiled application:
Under Choose what you want to profile, New Process Run, click Add run configuration.
In the New Run Configuration wizard, choose .NET Process and click Next.
If required, in Set environment variables specify environment variables. Each variable must be specified on a new line.
Make sure the created run configuration is selected in the New Process Run list.
Under Choose how you want to profile it, specify profiling options:
Profiling Type: typically, you should choose between Sampling (evaluate performance and determine the slowest methods in your app) and Timeline (same as Sampling but with additional timeline data). Learn more about profiling types
If you cannot guarantee that the profiled process will be the first process started after you run the profiling session, set up a process filter.
If required, specify other profiling options.
If you want dotTrace to start collecting profiling data right after you start the session, under Run profiling, select Collect profiling data from start.
Run the application you want to profile. The profiling session will start right after the profiler attaches to the application process.
- What if the profiler doesn't attach to my process?
The process you're trying to profile is not a managed process.
The profiler has attached to another managed process started in the system. Try restarting profiling and if the problem persists, configure process filters.
Some issues are possible for processes targeting .NET 6.0 and later. If profiling does not start, try restarting the process and all its parent processes. For example, if you run your process from the Windows command prompt, restart both the command prompt and the process.
Go through a particular workflow in your application (if you want to evaluate its performance) or reproduce a particular performance issue. Collect snapshots using the Get Snapshot button in the profiling controller window. Learn more about how to control the profiling session
After you collect the data, either close the profiled application or detach the profiler using the Detach button in the controller window.
Analyze the collected snapshots using dotTrace Viewer.