This article is contributed. See the original author and article here.
While many blogs talk about capturing memory dump for .NET application on Windows platform, this blog introduces one way of collecting .NET Core dump on Linux Web App with dotnet-dump tool.
1. SSH to web app.

2. Install .NET Core SDK with following commands. Here we use Debian 10 distribution as an example. For installing .NET Core SDK on other Linux distributions, you may refer to document at https://docs.microsoft.com/en-gb/dotnet/core/install/linux.
apt-get update
apt-get install -y wget
wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
apt-get install -y apt-transport-https
apt-get update
apt-get install -y dotnet-sdk-3.1
3. Install dotnet-dump tool.
dotnet tool install –global dotnet-dump –version 3.1.141901
4. Refresh SSH session window to enable dotnet-dump command.
5. Check dotnet process id. In example below, process id of the web app is 29.
ps aux | grep dotnet

6. Change directory to persistent storage.
cd /home/LogFiles
7. Capture dotnet core dump.
dotnet-dump collect -p [process-id] –type Full –diag
-p|–process-id <PID>
Specifies the process ID number to collect a dump from.
–type <Full|Heap|Mini>
Specifies the dump type, which determines the kinds of information that are collected from the process. There are three types:
Full – The largest dump containing all memory including the module images.
Heap – A large and relatively comprehensive dump containing module lists, thread lists, all stacks, exception information, handle information, and all memory except for mapped images.
Mini – A small dump containing module lists, thread lists, exception information, and all stacks.
–diag
Enables dump collection diagnostic logging.
8. Once capture completed, we should be able to see dump file in the “/home/LogFiles” directory.
References:
https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-dump
Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.
Recent Comments