Pio isnt recognizing the active workig project while compiling

It was observed that in newer PlatformIO extension version (the core is irrelevant for that), correct project selection can fail.

As countermeasures you can try and open the platformio.ini for the project that you want to compile, and then refreshing the project tasks.

grafik

You might also want to try the new beta version which has many fixes: PlatformIO IDE for VSCode 2.3 Beta – Help us with testing!

It explicitly has the project selection in the status bar now for switching, too.