SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
Debugging a .NET program after crash
(Post-mortem debugging)
Mirco Vanini
Sponsors
With the support of:
About me
Mirco Vanini
Microsoft MVP Developer Technologies
Consultant focused on industrial and embedded
solutions using .NET and other native SDKs with over 30
years of experience, XeDotNet community co-founder,
speaker and Microsoft MVP since 2012
@MircoVanini
www.proxsoft.it
https://www.linkedin.com/in/proxsoft
Software Bugs are Expensive
Debugging is twice as hard as writing the code in the
first place. Therefore, if you write the code as cleverly
as possible, you are, by definition, not smart enough
to debug it.
Brian Kernighan
Importance of debugging
• Perfect code is an illusion
• Legacy Code
• Deeper Understanding
• Helps you learn & write better code in the future
Production Debugging
Requirements
• Obtain actionable
information about crashes
and errors
• Obtain accurate
performance information
Limitations
• Can’t install Visual Studio
• Can’t suspend production
servers
• Can’t run intrusive tools
Dump File
• A user dump is a snapshot of a running process
• A kernel dump is a snapshot of the entire system
• Dump files are useful for post-mortem diagnostics and
for production debugging
• Anytime you can’t attach and start live debugging, a
dump might help
Limitations of Dump Files
• A dump file is a static snapshot
• You can’t debug a dump, just analyze it
• Sometimes a repro is required (or more than one
repro)
• Sometimes several dumps must be compared
Taxonomy of Dumps
• Crash dumps are dumps generated when an
application crashes
• Hang dumps are dumps generated on-demand at a
specific moment
• These are just names, the contents of the dump files
are the same!
Generating a Hang Dump
Task Manager
right-click and choose “Create Dump File”
Creates a dump in %LOCALAPPDATA%Temp
SysInternals - Procdump
Sysinternals utility for creating dumps,
Light-weight, no-install utility for generating dumps
DebugDiag
Microsoft tool for monitoring and dump generation
Generating a Hang Dump
SysInternals - Process Explorer
Right-click on the process and
select the "Create Dump" menu item
Generating a Hang Dump
.NET Core diagnostic global tools
dotnet-dump
The dotnet-dump tool is a way to collect and analyze Windows and Linux core dumps
without a native debugger.
dotnet-gcdump
The dotnet-gcdump tool is a way to collect GC (Garbage Collector) dumps of live .NET
processes.
Generating a Hang Dump
Azure App Services
Select your App Service
Go to "Diagnose and solve problems”
Select Diagnose Tools
Select "Collect Memory Dump”
Click on the "Collect Memory Dump" button
After a few minutes, the dump
is available in the configured storage account
Collect and Automate Diagnostic Actions with Azure
App Services
Analyzing Dumps File
Native debugger (WinDBG)
Analyze crash dump files by using WinDbg
DebugDiag
How to Use Debug Diagnostics to Analyze a Memory Dump
Visual Studio
Dump files in the Visual Studio debugger
Demo
• Null reference exceptions
• GC Heap pressure, OOM Exceptions
• Stack overflow
• Dead Lock
• Threadpool OutOfThreads
Common Bugs
CRASHES
• Check the event viewer
• Capture dump on crash
• Look at the faulting stack
PERFORMMANCE ISSUES
• Capture one or more
dumps
• Look at all stacks
• if you can repro in test,
consider profiling
• Low CPU
Waiting for an external resource
Deadlock
• High CPU
Tight loop, High CPU in GC
MEMORY LEAKS
• Capture multiple dumps
• Compare to see what
objects are leaking
• Find out why they are still
around
Q&A
Thanks !
@MircoVanini
www.proxsoft.it
https://www.linkedin.com/in/proxsoft

Weitere ähnliche Inhalte

Ähnlich wie Debugging a .NET program after crash (Post-mortem debugging)

Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyBrian Lyttle
 
A modern architecturereview–usingcodereviewtools-ver-3.5
A modern architecturereview–usingcodereviewtools-ver-3.5A modern architecturereview–usingcodereviewtools-ver-3.5
A modern architecturereview–usingcodereviewtools-ver-3.5SSW
 
Ship code like a keptn
Ship code like a keptnShip code like a keptn
Ship code like a keptnRob Jahn
 
Rock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment WorkflowsRock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment WorkflowsAOE
 
Reproducibility in artificial intelligence
Reproducibility in artificial intelligenceReproducibility in artificial intelligence
Reproducibility in artificial intelligenceCarlos Toxtli
 
10x programmers: Myth or Real?
10x programmers: Myth or Real?10x programmers: Myth or Real?
10x programmers: Myth or Real?joycsc
 
Moving to tdd bdd
Moving to tdd bddMoving to tdd bdd
Moving to tdd bddKim Carter
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integrationdrluckyspin
 
Cerebro for vfx eng
Cerebro for vfx engCerebro for vfx eng
Cerebro for vfx engCineSoft
 
How to build a proper software staging environment for testing
How to build a proper software staging environment for testing How to build a proper software staging environment for testing
How to build a proper software staging environment for testing TestCampRO
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Controlelliando dias
 
Automate your build on Android with Jenkins
Automate your build on Android with JenkinsAutomate your build on Android with Jenkins
Automate your build on Android with JenkinsBeMyApp
 
Accidentaltechie5 17-2011
Accidentaltechie5 17-2011Accidentaltechie5 17-2011
Accidentaltechie5 17-2011Highway T
 
MobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsMobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsRon Munitz
 
Deploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute Stick
Deploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute StickDeploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute Stick
Deploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute StickIntel® Software
 

Ähnlich wie Debugging a .NET program after crash (Post-mortem debugging) (20)

Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
Spug pt session2 - debuggingl
Spug pt session2 - debugginglSpug pt session2 - debuggingl
Spug pt session2 - debuggingl
 
A modern architecturereview–usingcodereviewtools-ver-3.5
A modern architecturereview–usingcodereviewtools-ver-3.5A modern architecturereview–usingcodereviewtools-ver-3.5
A modern architecturereview–usingcodereviewtools-ver-3.5
 
Ship code like a keptn
Ship code like a keptnShip code like a keptn
Ship code like a keptn
 
Diagnosing issues in your ASP.NET applications in production with Visual Stud...
Diagnosing issues in your ASP.NET applications in production with Visual Stud...Diagnosing issues in your ASP.NET applications in production with Visual Stud...
Diagnosing issues in your ASP.NET applications in production with Visual Stud...
 
Rock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment WorkflowsRock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment Workflows
 
Reproducibility in artificial intelligence
Reproducibility in artificial intelligenceReproducibility in artificial intelligence
Reproducibility in artificial intelligence
 
10x programmers: Myth or Real?
10x programmers: Myth or Real?10x programmers: Myth or Real?
10x programmers: Myth or Real?
 
Moving to tdd bdd
Moving to tdd bddMoving to tdd bdd
Moving to tdd bdd
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Cerebro for vfx eng
Cerebro for vfx engCerebro for vfx eng
Cerebro for vfx eng
 
How to build a proper software staging environment for testing
How to build a proper software staging environment for testing How to build a proper software staging environment for testing
How to build a proper software staging environment for testing
 
Continuous integration at CartoDB
Continuous integration at CartoDBContinuous integration at CartoDB
Continuous integration at CartoDB
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
 
Automate your build on Android with Jenkins
Automate your build on Android with JenkinsAutomate your build on Android with Jenkins
Automate your build on Android with Jenkins
 
W1.pptx
W1.pptxW1.pptx
W1.pptx
 
Python Diamond Tool
Python Diamond ToolPython Diamond Tool
Python Diamond Tool
 
Accidentaltechie5 17-2011
Accidentaltechie5 17-2011Accidentaltechie5 17-2011
Accidentaltechie5 17-2011
 
MobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsMobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android Apps
 
Deploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute Stick
Deploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute StickDeploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute Stick
Deploy Real-Time Object Detectors on Intel® Movidius™ Neural Compute Stick
 

Mehr von Mirco Vanini

.NET 7 Performance Improvements_10_03_2023.pdf
.NET 7 Performance Improvements_10_03_2023.pdf.NET 7 Performance Improvements_10_03_2023.pdf
.NET 7 Performance Improvements_10_03_2023.pdfMirco Vanini
 
Connect a chips to Azure
Connect a chips to AzureConnect a chips to Azure
Connect a chips to AzureMirco Vanini
 
Connect a chips to Azure
Connect a chips to AzureConnect a chips to Azure
Connect a chips to AzureMirco Vanini
 
How to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDKHow to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDKMirco Vanini
 
.NET Conf 2021 - Hot Topics Desktop Development
.NET Conf 2021 - Hot Topics Desktop Development.NET Conf 2021 - Hot Topics Desktop Development
.NET Conf 2021 - Hot Topics Desktop DevelopmentMirco Vanini
 
Async Debugging A Practical Guide to survive !
Async Debugging A Practical Guide to survive !Async Debugging A Practical Guide to survive !
Async Debugging A Practical Guide to survive !Mirco Vanini
 
IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)Mirco Vanini
 
Async Debugging - A Practical Guide to survive !
Async Debugging - A Practical Guide to survive !Async Debugging - A Practical Guide to survive !
Async Debugging - A Practical Guide to survive !Mirco Vanini
 
IoT support for .NET Core
IoT support for .NET CoreIoT support for .NET Core
IoT support for .NET CoreMirco Vanini
 
IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020Mirco Vanini
 
.NET Conf 2020 - Hot Topics Desktop Development
.NET Conf 2020 - Hot Topics Desktop Development.NET Conf 2020 - Hot Topics Desktop Development
.NET Conf 2020 - Hot Topics Desktop DevelopmentMirco Vanini
 
Are you ready for Microsoft Azure Sphere?
Are you ready for Microsoft Azure Sphere?Are you ready for Microsoft Azure Sphere?
Are you ready for Microsoft Azure Sphere?Mirco Vanini
 
IoT Day 2019 Naples - Microsoft Azure Shpere
IoT Day 2019 Naples - Microsoft Azure ShpereIoT Day 2019 Naples - Microsoft Azure Shpere
IoT Day 2019 Naples - Microsoft Azure ShpereMirco Vanini
 
Debugging with VS2019
Debugging with VS2019Debugging with VS2019
Debugging with VS2019Mirco Vanini
 
Optimising code using Span<T>
Optimising code using Span<T>Optimising code using Span<T>
Optimising code using Span<T>Mirco Vanini
 
Xe OneDay - Modernizing Enterprise Apps
Xe OneDay - Modernizing Enterprise AppsXe OneDay - Modernizing Enterprise Apps
Xe OneDay - Modernizing Enterprise AppsMirco Vanini
 
Azure Sphere - GAB 2019
Azure Sphere - GAB 2019Azure Sphere - GAB 2019
Azure Sphere - GAB 2019Mirco Vanini
 

Mehr von Mirco Vanini (20)

.NET 7 Performance Improvements_10_03_2023.pdf
.NET 7 Performance Improvements_10_03_2023.pdf.NET 7 Performance Improvements_10_03_2023.pdf
.NET 7 Performance Improvements_10_03_2023.pdf
 
Connect a chips to Azure
Connect a chips to AzureConnect a chips to Azure
Connect a chips to Azure
 
Connect a chips to Azure
Connect a chips to AzureConnect a chips to Azure
Connect a chips to Azure
 
How to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDKHow to modernise WPF and Windows Forms applications with Windows Apps SDK
How to modernise WPF and Windows Forms applications with Windows Apps SDK
 
C# on a CHIPs
C# on a CHIPsC# on a CHIPs
C# on a CHIPs
 
.NET Conf 2021 - Hot Topics Desktop Development
.NET Conf 2021 - Hot Topics Desktop Development.NET Conf 2021 - Hot Topics Desktop Development
.NET Conf 2021 - Hot Topics Desktop Development
 
Async Debugging A Practical Guide to survive !
Async Debugging A Practical Guide to survive !Async Debugging A Practical Guide to survive !
Async Debugging A Practical Guide to survive !
 
IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)IoT support for .NET (Core/5/6)
IoT support for .NET (Core/5/6)
 
Async Debugging - A Practical Guide to survive !
Async Debugging - A Practical Guide to survive !Async Debugging - A Practical Guide to survive !
Async Debugging - A Practical Guide to survive !
 
IoT support for .NET Core
IoT support for .NET CoreIoT support for .NET Core
IoT support for .NET Core
 
IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020IoT support for .NET Core - IoT Saturday 2020
IoT support for .NET Core - IoT Saturday 2020
 
.NET Conf 2020 - Hot Topics Desktop Development
.NET Conf 2020 - Hot Topics Desktop Development.NET Conf 2020 - Hot Topics Desktop Development
.NET Conf 2020 - Hot Topics Desktop Development
 
Are you ready for Microsoft Azure Sphere?
Are you ready for Microsoft Azure Sphere?Are you ready for Microsoft Azure Sphere?
Are you ready for Microsoft Azure Sphere?
 
IoT Day 2019 Naples - Microsoft Azure Shpere
IoT Day 2019 Naples - Microsoft Azure ShpereIoT Day 2019 Naples - Microsoft Azure Shpere
IoT Day 2019 Naples - Microsoft Azure Shpere
 
Debugging with VS2019
Debugging with VS2019Debugging with VS2019
Debugging with VS2019
 
Azure Sphere
Azure SphereAzure Sphere
Azure Sphere
 
Optimising code using Span<T>
Optimising code using Span<T>Optimising code using Span<T>
Optimising code using Span<T>
 
Azure Sphere
Azure SphereAzure Sphere
Azure Sphere
 
Xe OneDay - Modernizing Enterprise Apps
Xe OneDay - Modernizing Enterprise AppsXe OneDay - Modernizing Enterprise Apps
Xe OneDay - Modernizing Enterprise Apps
 
Azure Sphere - GAB 2019
Azure Sphere - GAB 2019Azure Sphere - GAB 2019
Azure Sphere - GAB 2019
 

Kürzlich hochgeladen

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Debugging a .NET program after crash (Post-mortem debugging)

  • 1. Debugging a .NET program after crash (Post-mortem debugging) Mirco Vanini
  • 3. About me Mirco Vanini Microsoft MVP Developer Technologies Consultant focused on industrial and embedded solutions using .NET and other native SDKs with over 30 years of experience, XeDotNet community co-founder, speaker and Microsoft MVP since 2012 @MircoVanini www.proxsoft.it https://www.linkedin.com/in/proxsoft
  • 4. Software Bugs are Expensive Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. Brian Kernighan
  • 5. Importance of debugging • Perfect code is an illusion • Legacy Code • Deeper Understanding • Helps you learn & write better code in the future
  • 6. Production Debugging Requirements • Obtain actionable information about crashes and errors • Obtain accurate performance information Limitations • Can’t install Visual Studio • Can’t suspend production servers • Can’t run intrusive tools
  • 7. Dump File • A user dump is a snapshot of a running process • A kernel dump is a snapshot of the entire system • Dump files are useful for post-mortem diagnostics and for production debugging • Anytime you can’t attach and start live debugging, a dump might help
  • 8. Limitations of Dump Files • A dump file is a static snapshot • You can’t debug a dump, just analyze it • Sometimes a repro is required (or more than one repro) • Sometimes several dumps must be compared
  • 9. Taxonomy of Dumps • Crash dumps are dumps generated when an application crashes • Hang dumps are dumps generated on-demand at a specific moment • These are just names, the contents of the dump files are the same!
  • 10. Generating a Hang Dump Task Manager right-click and choose “Create Dump File” Creates a dump in %LOCALAPPDATA%Temp SysInternals - Procdump Sysinternals utility for creating dumps, Light-weight, no-install utility for generating dumps DebugDiag Microsoft tool for monitoring and dump generation
  • 11. Generating a Hang Dump SysInternals - Process Explorer Right-click on the process and select the "Create Dump" menu item
  • 12. Generating a Hang Dump .NET Core diagnostic global tools dotnet-dump The dotnet-dump tool is a way to collect and analyze Windows and Linux core dumps without a native debugger. dotnet-gcdump The dotnet-gcdump tool is a way to collect GC (Garbage Collector) dumps of live .NET processes.
  • 13. Generating a Hang Dump Azure App Services Select your App Service Go to "Diagnose and solve problems” Select Diagnose Tools Select "Collect Memory Dump” Click on the "Collect Memory Dump" button After a few minutes, the dump is available in the configured storage account Collect and Automate Diagnostic Actions with Azure App Services
  • 14. Analyzing Dumps File Native debugger (WinDBG) Analyze crash dump files by using WinDbg DebugDiag How to Use Debug Diagnostics to Analyze a Memory Dump Visual Studio Dump files in the Visual Studio debugger
  • 15. Demo • Null reference exceptions • GC Heap pressure, OOM Exceptions • Stack overflow • Dead Lock • Threadpool OutOfThreads
  • 16. Common Bugs CRASHES • Check the event viewer • Capture dump on crash • Look at the faulting stack PERFORMMANCE ISSUES • Capture one or more dumps • Look at all stacks • if you can repro in test, consider profiling • Low CPU Waiting for an external resource Deadlock • High CPU Tight loop, High CPU in GC MEMORY LEAKS • Capture multiple dumps • Compare to see what objects are leaking • Find out why they are still around