dotnet trace command collects trace information from the os and base classes of your application. you can further enhance this output by adding your own trace information, but the information out of the box is generally enough to resolve issues.
- install the dotnet trace tool: dotnet tool install -g dotnet-trace
- run the application you want to trace
- list all running trace enabled processes: dotnet trace ps
- trace the process: dotnet trace collect -p
- when you are finished with tracing you will have a .nettrace file which can be viewed in visual studio. alternatively, you can change this format to speedscope format and run it through www.speedscope.app: dotnet trace convert trace.nettrace --format speedscope