简体   繁体   English

ReSharper 间歇性地显示有效 Razor 代码的红色错误

[英]ReSharper intermittently showing red errors for valid Razor code

When editing a CSHTML page, ReSharper is intermittedly showing some valid Razor syntax in red indicating an error.编辑 CSHTML 页面时,ReSharper 会间歇性地以红色显示一些有效的 Razor 语法,表示有错误。 The syntax is red when I open the file, turns normal when I make an edit, then turns red again after a save:打开文件时语法为红色,编辑时变为正常,保存后再次变为红色:

ReSharper CSHTML 错误

Even when red, the code builds successfully and ReSharper even gives correct information about the syntax on hover:即使在红色时,代码也能成功构建,ReSharper 甚至会在悬停时提供有关语法的正确信息:

在此处输入图片说明

My environment is:我的环境是:

  • ReSharper 10.0.2 ReSharper 10.0.2
  • Visual Studio Enterprise 2015 Update 1 Visual Studio Enterprise 2015 更新 1
  • ASP.NET 4.5 ASP.NET 4.5
  • MVC 5 MVC 5

I have tried the solutions offered in other questions (eg ReSharper "can not resolve symbol" even when project builds , Resharper is suddenly showing red for Razor syntax ) like Suspending/Resuming ReSharper, clearing caches, etc. I even tried reinstalling ReSharper entirely but none of that helped.我已经尝试了其他问题中提供的解决方案(例如, 即使在项目构建时 ReSharper“无法解析符号”Resharper 突然为 Razor 语法显示红色),例如暂停/恢复 ReSharper、清除缓存等。我什至尝试完全重新安装 ReSharper,但是这些都没有帮助。

Potentially relevant (?) is that I recently installed MVC 3 and MVC 4 for other projects, but I have since uninstalled them again.潜在相关 (?) 是我最近为其他项目安装了 MVC 3 和 MVC 4,但此后我又卸载了它们。

Any suggestions for what might be causing this?关于可能导致这种情况的任何建议? Could it be a ReSharper bug somehow?不知何故,它可能是 ReSharper 的错误吗?

UPDATE:更新:

This actually only happends when a ReSharper code cleanup is run and then a save is made.这实际上仅在运行 ReSharper 代码清理然后进行保存时才会发生。 I had an extension which did this automatically on every save, but having disabled that the actual flow is:我有一个扩展,它在每次保存时自动执行此操作,但禁用了实际流程:

  • Make edits - OK进行编辑 -确定
  • Save - OK保存 -确定
  • Clean up - OK清理 -好的
  • Save - RED保存 -红色

I am using the Default: Full Cleanup profile.我正在使用默认值:完全清理配置文件。

This appears to be a symptom of a known ReSharper bug, due to be fixed in version 10.1这似乎是已知的 ReSharper 错误的症状,由于在 10.1 版中已修复

See https://youtrack.jetbrains.com/issue/RSRP-455788请参阅https://youtrack.jetbrains.com/issue/RSRP-455788

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Resharper的Razor语法突然显示为红色 - Resharper is suddenly showing red for Razor syntax Resharper代码完成工具提示未显示 - Resharper code completion tooltip not showing 为什么Resharper会显示红色的“无法解析符号”错误? - Why is Resharper showing a red 'Cannot Resolve Symbol' error? VS Code 在 Unity C# 代码的错误下方未显示红色波浪线 - VS Code is not showing red squiggly lines beneath errors for Unity C# codes Razor 代码编辑器默认显示“�”? - Razor code EditorFor showing '�' as default? 用Razor和Resharper编写Javascript - Writing Javascript with Razor and Resharper 资源在项目上显示红线,但执行时没有错误 - Resource showing red lines across the project but no errors while executing 尽管测试通过代码运行,但 ReSharper dotcover 仍显示 0% 的覆盖率 - ReSharper dotcover showing 0% coverage despite tests running through code 为什么Visual Studio 2012无法格式化这个有效的Razor代码 - Why can't Visual Studio 2012 format this valid Razor code 如何防止Resharper在解决方案窗口中的错误显示CSS / javascript错误? - How do I prevent Resharper's error in solution window from showing CSS/javascript errors?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM