Resharper “Cannot resolve symbol” when the code well-compiled

烈酒焚心 提交于 2019-12-19 02:47:17

问题


I believe, the error message not related to Serilog specifically, but is rather because of the code/assembly/package specific structure/modifiers etc.

So, the issue is that Resharper shows the error (and the code (from assembly referenced) is not accessible for navigation to) when Visual Studio navigates (by Go to Definition command) to metadata and compiles the code well (including, showing the method description successfully as well).

The method is defined in assembly as follows:

namespace Serilog
{
    public static class Log
    {
        public static ILogger ForContext<TSource>();

My current version of Visual Studio: 2017 (15.4.4) Resharper: 2017.2.2

Generally, everything works well for me, but because of "lost" definition, my object defined (Logger) indicated as unresolved through the whole code, so all my scrolling bar is red with error notes, which is quite confusing.

Any thoughts?


回答1:


This following seems to work for me most of the time

Solution 1

Tools->Options->ReSharper 
  • Suspend Now
  • Resume

It refreshes the cache and/or some other dark magic


Solution 2

You could try clearing the ReSharper cache implicitly

ReSharper->Options->Environment->General 
  • Clear Caches.

Solution 3

You can also try unloading and then reloading the project.

Solution Explorer->Right Click
  • Unload Project
  • Reload Project

Solution 4

As a last resort you can try to delete the solution cache manually

%LOCALAPPDATA%\JetBrains\Transient\ReSharperPlatformVsXX\vXX\SolutionCaches\


来源:https://stackoverflow.com/questions/48654852/resharper-cannot-resolve-symbol-when-the-code-well-compiled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!