DEV Community

Discussion on: What's the best thing to do when you've run into a debugging dead end?

Collapse
 
olistik profile image
olistik

Stop locally and restart from the simplest working context.
It's almost like performing a git bisect.

0: disable/comment almost everything so that you have the simplest context;
1: test if the context behaves like it's supposed to behave;
2: if it does then re-enable/uncomment half of the things back and GOTO :1;
3: if it does not, then if the problem is self-evident, fix it and RETURN 🥳;
4: if it does not, you already know that the things just restored are responsible for the issue. You can pinpoint the issue even further by disabling/commenting half of the things you have just restored and GOTO :1;

The key point here is that you waste a few minutes in order to get to :0 but avoid wasting several hours finding a bug that is probably way above the context you're looking at.

It can appear vague but it's a debugging process that can be performed in a wide variety of contexts, not just source code.