because something in your code is wrong,which we can't see.
If you create a minimal project that shows the problem and post it, I can try and run it, and see if I can find the problem.