I also encountered this problem, the solution is very simple: do not use the same thread to SendInput.
I used it in C#, and after wrapping SendInput with Task.Run there was no problem.