cbsch.no


.Net / Powershell debugging

powershell

Notes on debugging .Net / Powershell

Core dumps

References

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