Insanity: doing the same thing over and over again and expecting different results. --Einstein
How many times, as a developer, have you found yourself mindlessly and stubbornly trying to solve a problem (some thrown exception, for example) for an hour, two hours, or even longer, without a solution?
This is like the Einstein quote above: madness! What you need to do is get Another Set of Eyes to sit by you while you work your way through the issue. It doesn't even have to be a developer who is very familiar with the codebase you're working on -- the mere act of "changing the paradigm" will enable you to look at the problem more objectively and find the answer quickly.
In a team environment, we have a general rule that if you're stuck on a problem for more than 20 or 30 minutes, you put your ego in your back pocket and ask another developer to come sit by you while you demonstrate the issue.
Recently another developer I work with asked me over. He admitted having so far spent some 5 hours on an exception that he could not figure out. After sitting with him for ten minutes, he himself found the answer. It works.
Suprise! Ask for help, and willingly give help. The problem gets solved. Try it!