fix(sac): 修复预览页序列化 SacInfo 时 TypeId 触发 IsGenericParameter 异常

- SacDescriptionAttribute 增加 ShouldSerializeTypeId() 返回 false,
  跳过 Attribute.TypeId(System.Type)的序列化,避免 Newtonsoft 抛
  "Method may only be called on a Type for which Type.IsGenericParameter is true."
  (13.0.1 安全版对 Type 成员序列化行为变更后暴露)
- ExceptionMiddleware 改用 exception.ToString() 记录完整异常(类型+
  内层 message+堆栈),替代仅取最内层 message,便于定位此类反射异常根因;
  该信息仅写入日志,不返回前端
This commit is contained in:
hjhan
2026-07-31 09:10:18 +08:00
parent a871bcb9fe
commit ca74095e0c
2 changed files with 10 additions and 13 deletions
@@ -117,6 +117,12 @@ namespace YLErp.Modules.SuperviseReportModule.SAC.Common
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
public class SacDescriptionAttribute : Attribute
{
// Attribute.TypeId 本质是 System.TypeNewtonsoft 序列化会触发
// "Method may only be called on a Type for which Type.IsGenericParameter is true."
// 预览页用 ToJson() 序列化 SacInfo/List<SacInfo> 时崩溃,故显式跳过该成员。
// 13.0.1 安全版对 Type 成员序列化行为变更后暴露此问题)
public bool ShouldSerializeTypeId() => false;
/// <summary>
/// 字段名
/// </summary>