I have the same problem with some .NET projects in visual studio 2022. The only thing that works for me is to right click on the project in Solution Explorer
and click Unload project
and then Reload project
.
This solves the problem temporarily, but after a few days the same problem occurs again. I'm not quite sure if it's because the project is too large.