70 likes | 77 Views
Learn how to debug managed exceptions in a production environment, including collecting relevant data, using common debugger commands, and understanding first and second chance exceptions.
E N D
.NET Debugging for the Production Environment Part 6: Debugging a Managed Exception Brad Linscott Premier Field Engineering
Agenda • Managed exceptions • Data to collect in production environment • Common debugger commands for managed exceptions • Demo
Managed Exceptions • 1st chance (non-fatal) and 2nd chance (fatal/crash) • Like everything else in .NET, an exception is an object. • Too many too quickly will degrade performance.
Data to Collect for Exceptions • Perfmon (.NET CLR Exceptions/#ExceptionsThrown/sec) exposes frequency of exceptions • Dump file when exception is thrown • DebugDiag/ADPlus can be configured to automate the procedure
Common Debugger Commands for High CPU Hangs • !PrintException (addr), if alive on the current thread • !DumpObject (addr); Look for InnerException • To find the offending function(s), use stack & thread commands • Any variant of ‘k’ (kb, kn, kp, k, etc.) for native stacks • !psscorX.clrstack for managed stack (X=2, 4) • Other thread/stack commands • Sometimes we need help finding the executing line of code in the offending function • u;!u
Feedback? • Send us your feedback! • What other topics do you want covered?