ReSharper 的静态分析器似乎已损坏.我如何解决它? [英] ReSharper's static analyzer appears to be corrupted. How do I fix it?
问题描述
我遇到了 ReSharper 提供明显错误建议的问题.例如,在以下代码示例中,ReSharper 表示从不使用 response
、dates
和 ex
变量用于以下几行:
I'm having a problem with ReSharper giving obviously wrong advice. For example, in the following code sample, ReSharper is saying that the response
, dates
, and ex
variables are never used, when they are clearly used on the following lines:
Dim response As New WcfResponseBoolean
Try
' ReSharper identifies 'b' as unused, but it is used on the next line.
b = Builders.CastBuilderFromSession
If b Is Nothing Then
response.SetSessionExpired()
Return response
End If
' ReSharper identifies 'dates' as unused, but it is used on the next line.
Dim dates As New List(Of DateTime)({ConvertToUSDateTime(inWithTime)})
CompareDateList(response, inTimeToCompare, New ComparableDatesList()
With {.Dates = dates, .CheckCompareType = compareType}, False)
' ReSharper identifies 'ex' as unused, but it is used on the next line.
Catch ex As Exception
MailHandler.SendExceptionEmailToBTDebug(ex, "CompareDates")
response.SetUnhandledException()
End Try
我已按照 此链接中的建议 尝试清除 ReSharper 的通过转到 ReSharper --> 选项 --> 环境 --> 常规并单击清除缓存"按钮来缓存.但是当我点击那个按钮时,我没有从 ReSharper 那里得到任何关于发生任何事情的反馈.屏幕就在那里;没有弹出消息,没有任何类型的 UI 反馈.当我单击保存"按钮关闭表单时,问题仍然存在.
I've followed the advice from this link to try clearing ReSharper's caches by going to ReSharper --> Options --> Environment --> General and clicking the "Clear Caches" button. But when I click that button, I get no feedback from ReSharper that anything happened. The screen just sits there; no popup message, no UI feedback of any kind. And when I click the Save button to close the form, the problem persists.
TL;DR:
有没有其他方法可以清除 ReSharper 的缓存?否则,是否有其他方法可以让静态分析器再次工作?
我在 Visual Studio 2012(版本 11.0.61030.0)中运行 ReSharper 8.1.23.546.
I'm running ReSharper 8.1.23.546 in Visual Studio 2012 (version 11.0.61030.0).
更新 1:
我还尝试清理和重建项目,以及关闭和打开 Visual Studio.这些都没有任何影响.从这里我能想到的唯一两件事是:
I've also tried cleaning and rebuilding the project, and closing and opening Visual Studio. Neither of these have had any effect. The only two things I can think to do from here are:
- 手动删除 ReSharper 的缓存文件.但我不知道它们位于何处,而且我不确定这样做是否安全.
- 卸载并重新安装 ReSharper.但这似乎很激烈.我宁愿不这样做,除非这是唯一的选择.
更新 2:
我使用 citizenmatt's answer 来定位和删除缓存文件,但没有任何区别.ReSharper 仍在将变量标识为未使用.
I used citizenmatt's answer to locate and delete the cache files, but it didn't make any difference. ReSharper is still identifying the variables as unused.
我还重新启动了我的电脑,但我还没有这样做,但正如我所料,这并没有真正改变任何东西.我可能会认为卸载和重新安装是唯一的选择.
I also rebooted my PC, which I had not done yet, but as I expected that didn't really change anything. I may be getting to the point that uninstalling and reinstalling is the only option left.
更新 3:
我吃完午饭回来,决定硬着头皮卸载并重新安装.这也没有解决这个问题.现在我越来越绝望了.
I came back from lunch and decided to bite the bullet and do an uninstall and reinstall. That did not fix this issue either. Now I'm getting desperate.
推荐答案
您可以在 %LOCALAPPDATA%\JetBrains\ReSharper\v8.1\SolutionCaches
找到解决方案缓存.缓存文件夹名为_ReSharper.{Solution}.{hash}
,其中{solution}
是解决方案的名称,hash是一个数值,防止名称冲突.您应该能够找到您要找的那个.在关闭 Visual Studio 的情况下将其删除并重新打开解决方案.
You can find the solution caches at %LOCALAPPDATA%\JetBrains\ReSharper\v8.1\SolutionCaches
. The cache folder is named _ReSharper.{Solution}.{hash}
, where {solution}
is the name of the solution, and the hash is a numeric value to prevent name clashes. You should be able to find the one you're looking for. Delete it with Visual Studio closed and reopen the solution.
这篇关于ReSharper 的静态分析器似乎已损坏.我如何解决它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!