net debugging 2017
TRANSCRIPT
Threads call stacks, stack objects
Modules dlls, exes
.NET Heap .net objects, sizes, info
@TessFerrandez
PROCDUMP
Light-weight, no-install utility for generating dumps
Procdump –ma app.exe app.dmpProcdump –ma –h app.exe hang.dmpProcdump –ma –e app.exe crash.dmp Procdump –ma –c 90 app.exe cpu.dmp
@TessFerrandez
DEBUG DIAG
GUI tool to generate dumps based on rules and analyze dumps for common .net issues
@TessFerrandez
When I open an email with a pdf attachement that is
larger than 2 MB, a message box saying Unknown Error
shows up and then the process exits
Tess!!! the internet e-thingy is not working anymore
WHO
DUNNIT?
Unhandled Exception – 2nd chance
StackOverflowException
OutOfMemoryException
ExecutionEngineException
Kill or recycle
WHO
DUNNIT?
LOW CPU
Waiting for an external resource
Deadlock
HIGH CPU
Busy, Tight loop
High CPU in GC
1 Determine if it is high or low CPU
2 Capture one or more dumps
3 Look at all stacks
If you can repro in test, consider profiling
@TessFerrandez
OutOfMemoryExceptions
Slow response timesDue to GC activities
Memory increase in perfmon or task manager
1 Capture multiple dumps
2 Compare to see what objects are leaking
3 Find out why they are still around
For native leaks, use leaktracking in debug diag
@TessFerrandez
DataTarget target = DataTarget.LoadCrashDump(@"TheApp.dmp");
target.SymbolLocator.SymbolCache = @"c:\symbols";
target.SymbolLocator.SymbolPath = "http://msdl.microsoft.com/download/symbols";
var runtime = target.ClrVersions[0].CreateRuntime();
Console.WriteLine("Is Server GC: {0}", runtime.ServerGC);
Console.WriteLine("Number of heaps: {0}", runtime.HeapCount);
Console.WriteLine("Number of threads: {0}", runtime.Threads.Count);
@TessFerrandez
foreach (var thread in runtime.Threads) {
var e = thread.CurrentException;
if (e != null) {
Console.WriteLine("Thread {0}", thread.ManagedThreadId);
Console.WriteLine("\t{0} - {1}", e.Type.Name, e.Message);
foreach (var frame in e.StackTrace) {
Console.WriteLine("\t" + frame.DisplayString);
}
}
}
@TessFerrandez