I have a problem with debugging sessions. My program executes very well in a debug session but if I start a normal run, it behaves completely different.
The problem is, that I cannot say, why it acts different.
One possible reason is the slower execution time because you alway have to press F6 or so.
I tried to insert Thread.sleep(1000); but I don’t get the instruction causing the different behaviour.
So: What are hints, best practices to get to know why it acts so different in debug sessions?
Two solutions:
a) Use poor man’s debugger (print to the console) or use a logging framework. After the error happens, analyze the output.
b) Write a test case that tries to reproduce the problem. Even if you can’t find it that way, this will clean your code and sometimes solve the issue.