I had this same issue, nothing fixed it. See this thread
I tried vscode on another machine, same thing. However, when i logged out of my account on the other machine, disabled all extensions but the platformio and c++ extensions required by pio - the issue STILL happened. This told me the issue was not my machine, but my extension settings, so I went and checked the c++ extension - it was on the pre-release version. I switched to the release version - problem solved (for now). I am absolutely positive this was the cause of the issue. I tried everything prior, reinstalling vscode, reinstalling platformio (10 times might I add), checking user permissions, disabling windows defender, etc etc. Nothing worked. Check your c++ extension and ensure that it is on the ´release´ version, not the ´pre-release´. Then, delete the contents of the ´.platformio/packages´, ´.platformio/platforms´, ´.platformio/.cache´ folders and rebuild the project.