Yes, in the past I used the local Dropbox folder and eventually I would run into similar problems.
Don't use onedrive, Dropbox for your active source folder. Set up another folder and then when you have finished copy your project to the synchronized folder or even better use Git on your PC and let it sync.