This might not be relevant for everyone, but it recently happened to me and could help someone in the future. I encountered this issue while using Visual Studio 2022 Preview 4. Switching back to the non-preview version resolved it.