JetBrains Rider 2026.1 Help

代码检查:不安全上下文声明是冗余的

当不需要时,该检查会报告 unsafe 上下文。 当声明或语句不包含任何不安全代码,或者代码已在另一个不安全上下文中时,就会发生这种情况。

示例

unsafe class C { public int GetValue() => 0; }
class C { public int GetValue() => 0; }

快速修复

快速修复会移除冗余的 unsafe 修饰符或代码块。

2026年 5月 8日