To my understanding a Thread.Sleep(0) force a context switch on the OS.
I wanted to check what was the maximum amount of time that could pass in an application befor
Most likely cause is that you aren't allowing the program to read instructions in an efficient manner.
When you invoke Sleep(0)
your code is suspended for a single cycle and then scheduled for the next available slot. However, this context switching isn't free - there are plenty of registers to save/load, and when you have a different sequence of instructions to read from disk you probably end up with quite a few cache misses. I can't imagine this having a significant impact on your application in most cases, but if you are working with a real-time system or something similarly intensive then it might be a possibility.