【发布时间】:2022-12-21 20:30:25
【问题描述】:
Visual Studio 专业版 2022、ReSharper 2022。
在 Visual Studio 中编写一些“正常”C# 代码时,我遇到了一个问题,即所有语法突出显示都丢失了,并出现了一些异常的编译器错误。语法突出显示在所有其他文件中继续按预期工作。
编译器错误在不同位置显示不同:
- 将鼠标悬停在文件上时:“表达式太长或太复杂,无法编译”
- 在文件中:“参数为‘ref’,而参数声明为‘value’”
如第二张图片所示,导致错误的代码如下:
public class Location : ILocation
{
public int InventoryId { get; }
public IReferences References { get; }
public Location(IInventoryLocation location)
{
var shortRef = location.References
.Single(ref => ref.ReferenceType == ReferenceType.Short);
// ...
}
}
【问题讨论】:
标签: c# visual-studio resharper syntax-highlighting