Debugging should never be done chaotically. Below you can find instructions how to debug in a structured way.
- Duplicate the Bug
The most important, no repro no fix - Describe the Bug
Keep it in database – easier to track changes - Always assume that the Bug is yours
If bug is in your code you can fix it, if not = trouble; eliminate any possibility before looking elsewhere - Divide and conquer
Hypothesis and elimination, look into code, like a binary search. - Think creatively
Version mismatches, operating system differences, problems with program binaries or installations, external factors - Leverage Tools
Helps to investigate e.g. Error detection tools (invalid memory accesses, parameters to system APIs and COM interfaces) - Start Heavy Debugging
Much time on exploring program's operations - Verify that the Bug is fixed
Easy when isolated module, harder in critical code – verify for all data conditions, good and bad & regression. Changes to critical code => inform the team! - Learn and Share
Summarize what you have learned and share with colleagues – helps eliminate the bug faster.
Of course there is no need to follow all the steps. If the bug is found and fixed just go directly to the step no.8
The steps are taken from an excellent book "Debugging Applications for .Net and Microsoft Windows" by John Robbins.