Fahad
Fahad

Reputation: 1434

Start memory profiling of .NET Core app using dotMemory command line profiler

I am trying to do some memory profiling of an ASP.NET Core web application using the dotMemory command line profiler on a Debian 64-bit VM. I am able to run the app (with process id 1234 for example) and then attach the memory profiler following instructions given on the JetBrains help page.

./dotMemory.sh attach 1234 --save-to-dir=~/Snapshots

I now want to start the app using the memory profiler to get more information. This is not working however.

A fatal error occurred. The required library libhostfxr.so could not be found.

If this is a self-contained application, that library should exist in [/PathToWebApp/bin/].

If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].

The .NET runtime can be found at:

Unable to start profiling. An error occurred trying to start process '/PathToWebApp/bin/WebApp.dll' with working directory '/PathToWebApp'. Exec format error

Value of argument is invalid. File doesn't exist: dotnet

Note that I am able to start the WebApp successfully using the same command.

 dotnet /PathToWebApp/bin/WebApp.dll

How can I launch the application using the dotMemory profiler?

Upvotes: 1

Views: 1558

Answers (1)

Fahad
Fahad

Reputation: 1434

Got the answer from JetBrains support: need to use the start-net-core command to start an application using the dll.

/PathToScript/dotMemory.sh start-net-core /PathToWebApp/bin/WebApp.dll --save-to-dir=~/Snapshots

Upvotes: 1

Related Questions