重新共享“无法解析符号"当代码正确编译时 [英] Resharper "Cannot resolve symbol" when the code well-compiled

查看:130
本文介绍了重新共享“无法解析符号"当代码正确编译时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信,该错误消息与Serilog无关,而是由于特定于代码/程序集/程序包的结构/修饰符等.

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

因此,问题是当Visual Studio(通过Go to Definition命令)导航到元数据并很好地编译代码时,Resharper显示错误(并且代码(来自引用的程序集)无法导航到) (包括成功地显示方法说明).

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>();

我当前的版本 Visual Studio :2017年( 15.4.4 ) Resharper : 2017.2.2

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

通常,一切对我来说都很好,但是由于丢失"的原因,定义,我的对象定义(Logger)在整个代码中均表示为未解析,因此我的所有滚动条都带有红色的错误提示,这非常令人困惑.

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.

有什么想法吗?

推荐答案

以下内容在大多数情况下似乎对我有用

This following seems to work for me most of the time

解决方案1 ​​

Tools->Options->ReSharper 

  • 立即暂停
  • 恢复
  • 它刷新缓存和/或其他一些黑魔法

    It refreshes the cache and/or some other dark magic

    解决方案2

    您可以尝试隐式清除ReSharper缓存

    You could try clearing the ReSharper cache implicitly

    ReSharper->Options->Environment->General 
    

    • 清除缓存.
    • 解决方案3

      您还可以尝试卸载然后重新加载项目.

      You can also try unloading and then reloading the project.

      Solution Explorer->Right Click
      

      • 卸载项目
      • 重新加载项目
      • 解决方案4

        作为最后的选择,您可以尝试手动删除解决方案缓存

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

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

        这篇关于重新共享“无法解析符号"当代码正确编译时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆