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][1].

    ./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.


 - I get the following error when I try to run the profiler as described on the help page.

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

> 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:
>   - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=debian.9-x64&apphost_version=5.0.8


 - I get a different error when I try to run the profiler with the ".dll" as part of the app name.

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

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

 - I also tried using the `dotnet` keyword.

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

> Value of argument <application> 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?


  [1]: https://www.jetbrains.com/help/dotmemory/Working_with_dotMemory_Command-Line_Profiler.html

0
2 comments

Hi,

You should use /PathToScript/dotMemory.sh start-net-core /PathToWebApp/bin/WebApp.dll --save-to-dir=~/Snapshots command if you want to start application using .dll

Anyway, it seems this issue relates to installed dotnet on your machine. Could you please try to run profiling this way:

/PathToScript/dotmemory start --save-to-dir=~/Snapshots /path/to/dotnet /PathToWebApp/bin/WebApp

Where /path/to/dotnet is the path to dotnet executable file.

0

Hi Anna,

The first suggestion of using "start-net-core" worked, thanks for the quick response!

0

Please sign in to leave a comment.