I am currently debugging a buggy piece of legacy code, which leaks Handles all over the place. For further investigation I would like to keep track of the lines in the code where a Handle is created and the corresponding line where it is closed, in order to see if they are in balance.
I tried to set a breakpoint in the corresponding lines and watch the hit count, which works fine. But it is tedious to always break there. Is there a way to make Visual Studio only count the hit but continue with execution?
Thankful for any advice. KR
You could set the break point to break only when the hit count is a multiple of a very large number, so it does not break in your example, or at least not often.
Debugging with conditional breakpoints in Visual Studio 2012, 2015 and 2019.
Edit for future readers: as mentioned in your comment, the hit count will only be displayed when you have stopped execution, so make sure that some breakpoint will be hit at the time you want to examine it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With