'Visual Studio 2022 Razor Editor Crashes Occasionally

Sometimes after editing some parts of a razor source file, the editor crashes with tons of errors like the following screenshot:
razor editor crashes It fails to recognize these external components from NuGet packages and other source files.
This problem has been around for quite a while. Since it could be simply fixed by reloading the project, I didn't pay much attention to it at first. However, it started to appear frequently recently, I have to reload the project every few minutes, which is really annoying.
Maybe someone has also encountered this problem? It sucks to have to reload the project all the time!
To be mentioned, I'm using ReSharper 2021.3 along with VS2022, but ReSharper's global analyzers still work fine when VS's crashes.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source