Sometimes ReSharper incorrectly identifies successfully compiling code as errors and intellisense is broken

两盒软妹~` 提交于 2019-12-11 18:26:46

问题


Sometimes, after updating NuGets, ReSharper marks specific lines as errors, even though the solution builds, due to inability to recognize the type in use e.g. marks methods or properties in red, marks usage of object in red. In these cases the ReSharper intellisense is broken too.

In these cases sometimes reanalyzing all files in the "Errors in Solution" window and cleaning, closing Visual Studio, deleting the .suo file, reopening Visual Studio and Solution and building does not help.

Is there any way to fix this?


回答1:


I encountered this a few times, in all these cases, editing the .csproj file with the code misidentified as erroneous and modifying the references to the assemblies with the types not recognized from:

<Reference Include="AssemblyNameGoesHere, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\AssemblyNameGoesHere.1.3.0\lib\net45\AssemblyNameGoesHere.dll</HintPath>
  <Private>True</Private>
</Reference>

to

<Reference Include="AssemblyNameGoesHere">
  <HintPath>..\packages\AssemblyNameGoesHere.1.3.0\lib\net45\AssemblyNameGoesHere.dll</HintPath>
</Reference>

Solved this issue.

I reached this solution by comparing the .csproj files of the project with the "errors" other projects in the solution containing similar code that is was not marked as erroneous by ReSharper.



来源:https://stackoverflow.com/questions/33369700/sometimes-resharper-incorrectly-identifies-successfully-compiling-code-as-errors

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