Thursday, June 9, 2022

Cannot navigate to the symbol under the carret after updating VS 2022

After VS 2022 has been updated, suddenly some projects refuse to provide navigation between tokens, you can't just click on anything and "Go to Definition..."
There are couple of suggested workarounds, including restarting VS, deleting *.user files or going to Options/Debugging/Symbols and invoking Empty symbol cache
A working solution has been found here and it consists in updating the Microsoft.Net.Compilers package referenced in affected projects to a newer version.
This however, potentially causes another issue, this time on a build server, if you happen to rely on msbuild. This time, the MSB4184 is thrown
error MSB4184: The expression ""App_Start\RouteConfig.cs".GetPathsOfAllDirectoriesAbove()" 
cannot be evaluated. Method 'System.String.GetPathsOfAllDirectoriesAbove' not found
Turns out, this also has been observed. The proposed solution is to uninstall the Microsoft.Net.Compilers, this breaks token resolution is VS, though.
What seems to work for us is to have
  • Microsoft.Net.Compilers 2.10
  • Microsoft.CodeDom.Providers.DotNetCompilerPlatform 3.60