.Net / Powershell debugging
powershellNotes on debugging .Net / Powershell
Core dumps
References
- https://developer.samsung.com/tizen/blog/en-us/2020/07/31/identifying-memory-leaks-with-dotnet-dump-and-dotnet-gcdump
- https://docs.microsoft.com/en-us/dotnet/core/diagnostics/debug-linux-dumps
Install
dotnet tool install --global dotnet-dump
dotnet tool install --global dotnet-gcdump
Collect
Powershell on Ubuntu
sudo chmod u+x /opt/microsoft/powershell/7/createdump
sudo /opt/microsoft/powershell/7/createdump $pid
sudo chown $(whoami) /tmp/coredump.$pid
Analyze
analyze commands:
Start the analyzer
dotnet-dump analyze /tmp/coredump.$pid
Looking at the heap:
dumpheap -stat
dumpheap -type System.String[]
Misc
Get .NET version:
strings /opt/microsoft/powershell/7/pwsh | egrep '^[0-9]+\.[0-9]+\.[0-9]+$'
dotnet tool install --global dotnet-ildasm
dotnet-ildasm /opt/microsoft/powershell/7/pwsh