Performance profiling a .Net Core application child process

This tutorial demonstrates launching a .Net Core application, closing the application and inspecting the performance profiling results. 

Related tutorials:

Performance profiling a child process.
Performance profiling a service.
Performance profiling a child process of a service.
Performance profiling an IIS ISAPI DLL.
Performance profiling ASP.Net with IIS.
Performance profiling ASP.Net with Web Development Server.

Building the example applications

For this tutorial we’re going to work with dotNetCoreLauncher and consoleApp which are located in <Performance Validator install directory>\examples\dotNetCore\.

You will need to build these with Visual Studio 2019 (.Net Core 5) or Visual Studio 2022 (.Net Core 6). A solution file is provided for each version. If you’ve installed in the default program files location you’ll need to run Visual Studio in administrator mode to do the build.

We’re going to show you how to performance profile a child process launched from a .Net Core application. The process is the same for both Framework-dependent and Self-contained .Net Core applications. But the process is slightly different depending on whether the child process is Framework-dependent, Self-contained, .Net or native.

Publishing the application

Publishing the .Net Core application allows you to create an application that is framework dependent, or which is self contained.

The following command will create a framework dependent version and a self contained x64 version using Visual Studio 2019 and Visual Studio 2022.

Open a command prompt with administrator privileges.

cd c:\Program Files (x86)\Software Verify\Performance Validator x64\examples\dotNetCore

publish.bat

You can also use publish_vs2019.bat and publish_vs2022.bat for use with specific versions of Visual Studio.

Framework dependent .Net Core

  • Launch the sample application. Click on the launch icon on the toolbar.
    Coverage Validator launch toolbar
  • The Launch Application or Service dialog is displayed.
    Coverage Validator launch .Net Core application ro service dialog
  • Click Launch .Net Core Applications. The Launch .Net Core application dialog is displayed. By default it is configured for Framework Dependent .Net Core applications. You can change that from the .Net Core Application Type combo. For this tutorial we’ll leave it set to Framework Dependent.
    Performance Validator .Net Core Launch Dialog
  • We’re going to start dotNetCoreLauncher that we just built with publish.bat. This is in <Performance Validator install dir>\examples\dotNetCore\dotNetCoreLauncher\dotNetCoreLauncher\bin\debug\net5.0\win-x64\. You may need to replace net5.0 with net6.0 on your machine.

    Select the dotNetCoreLauncher_vs2019.dll using the Browse… button next to the Application to launch (*.dll) field.

    When you do this the Application to launch (*.exe) and Application to Monitor fields are populated with the .Net Core runtime, and the Application to launch (*.dll) is populated with the choice of dll. 
    Performance Validator .Net Core Launch Dialog Application to Launch

  • Now we need to specify the child process that we want to monitor. Click Edit… next to the Application to monitor (*.exe) field. 
    Performance Validator Edit Application to Monitor
  • The Applications to Monitor dialog is displayed.
    Performance Validator Applications to Monitor dialog
  • We need to add an application that we want to monitor. Click Add…
  • The Application to Monitor dialog is displayed.
    Performance Validator Application to Monitor dialog
  • This dialog allows us to specify the .Net Core application that is being launched and which child applications you want to monitor. The application being launched has already been configured based on your choices on the .Net Core launch dialog. You can specify as many child applications as you want. For this example we’re going to specify two child applications.
  • To add the first application click Add…. The Application and DLL dialog is displayed.
    Performance Validator Application and DLL dialog
  • We’re going to launch a .Net application, so leave the application type as it is. Click Browse… and choose <install dir>\examples\dotnetExample\bin\Release10_0\dotnetExample10_0.exe. Then click OK to accept this choice.
    Performance Validator .Net Core Application and DLL .Net Example
  • To add the second application click Add…. The Application and DLL dialog is displayed.
  • We’re going to launch a self contained .Net application, so change the Application Type to .Net Core (Self Contained). Click Browse… and choose <install dir>\examples\dotNetCore\consoleApp\consoleApp\bin\Debug\net5.0\win-x64\consoleApp_vs2019.exe. Then click OK to accept this choice.
    Performance Validator Application and DLL Self Contained Console App
  • The Application to Monitor dialog should now show four entries (for two applications) in the list. Click OK.
    Performance Validator .Net Core Application to Monitor dialog with 4 entries
  • The Applications to Monitor dialog will now show an additional entry in the list. Click OK.
    Performance Validator .Net Core Applications to Monitor dialog with  2 entries
  • Now that we have configured which child applications we want to monitor we choose an application. The Application to Monitor combo will display <<Any application that is launched>>, the name of the application we are launching, and the names of all the child applications that have been configured. You may need to widen the dialog to see the full path in the combo. Select <install dir>examples\dotNetCore\consoleApp\consoleApp\bin\Debug\net5.0\win-x64\consoleApp_vs2019.exe consoleApp_vs2019.dll.
  • Click the Launch button to launch the application.
  • The .Net Core dotNet.exe runtime is started to run the dotNetCoreLauncher_vs2019.dll application.
  • Performance Validator displays no profiling data because although an application has been started that is not the application we are monitoring.
    Performance Validator .Net Core Child Process Launcher
  • Choose 2 to launch dotNetExample. dotNetExample is launched but profiling data is not collected because you didn’t choose dotNetExample in the Application to Monitor combo. Close dotNetExample.
  • Choose 5 to launch the win-x64 configuration of self contained .Net Core consoleApp_vs2019.exe. consoleApp_vs2019.exe is launched and Performance Validator starts performance profiling the application.
    Performance Validator .Net Core realtime callstack view
  • Choose 0 to exit consoleApp_vs2019.exe.
  • The application closes. Performance Validator processes any remaining data and displays the final results.
    Performance Validator .Net Core Call Tree view
  • The performance profiling results are displayed on the Functions tab. These have been discussed in previous tutorials, we will not repeat that discussion here.

Self Contained .Net Core

The process for self contained .Net Core is very similar to the process described above for Framework Dependent .Net Core.

The difference is just how you specify the application to launch.

How you specify the child processes to monitor is identical to the process for Framework Dependent .Net Core.

  • Launch the sample application. Click on the launch icon on the toolbar.
    Coverage Validator launch toolbar
  • The Launch Application or Service dialog is displayed.
    Coverage Validator launch .Net Core application ro service dialog
  • Click Launch .Net Core Applications. The Launch .Net Core application dialog is displayed. Change the .Net Core application type to Self Contained using the .Net Core Application Type combo. 
    Coverage Validator .Net Core launch dialog self contained
  • We’re going to start dotNetCoreLauncher that we just built with publish.bat. This is in <Performance Validator install dir>\examples\dotNetCore\dotNetCoreLauncher\dotNetCoreLauncher\bin\debug\net5.0\win-x64\. You may need to replace net5.0 with net6.0 on your machine.

    Select the dotNetCoreLauncher_vs2019.exe using the Browse… button next to the Application to launch (*.exe) field.

    When you do this the Application to launch (*.dll) and Application to Monitor fields are populated with the executable, and the Application to launch (*.dll) is populated with a .Net Core dll that has the same name as the executable. 
    Coverage Validator .Net Core launch dialog, self contained

  • From this point on, please follow the tutorial process described above for Framework Dependent .Net Core, starting with Now we need to specify the child process that we want to monitor.

Fully functional, free for 30 days