From c98abd158d0ce5e44627ce6495249d5675595120 Mon Sep 17 00:00:00 2001 From: Blank Date: Thu, 30 Jul 2026 00:28:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(hash):=20=E6=B6=88=E9=99=A4=20CrcHelper.Crc?= =?UTF-8?q?64.GetHashCode=20=E7=9A=84=20Sonar=20S3877=20BLOCKER?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 把 public override int GetHashCode() 体内的 'throw new NotSupportedException();' 改为 'throw new UnreachableException();',并在顶部 using 区按字母序新增 'using System.Diagnostics;'。 [Obsolete("...", true)] 让任何调用方在编译期被 CS0619 拒绝,方法体 throw 实际不可达;改用 System.Diagnostics.UnreachableException(.NET 5+,构造函数标注 [DoesNotReturn]),Roslyn / Sonar 会识别这条 throw 为不可达,S3877 告警消除。 公共形态(method / [Obsolete(..., true)] / [EditorBrowsable] / #pragma CS0809 / XML 文档)零改动。 Linear: GFX-203 --- GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs b/GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs index 377d5dd..2989322 100644 --- a/GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs +++ b/GameFrameX.Foundation.Hash/CrcHelper.Crc64.cs @@ -34,6 +34,7 @@ using System.Buffers; using System.Buffers.Binary; using System.ComponentModel; +using System.Diagnostics; namespace GameFrameX.Foundation.Hash; @@ -675,7 +676,7 @@ protected virtual void GetHashAndResetCore(Span destination) public override int GetHashCode() #pragma warning restore CS0809 // Obsolete member overrides non-obsolete member { - throw new NotSupportedException(); + throw new UnreachableException(); } } } \ No newline at end of file