Repository navigation
fix(capability-hosting): 类型扫描失败纳入装配问题清单并保留加载原因 - #642
Conversation
CollectModuleTypes 在 ReflectionTypeLoadException 时原先抛 InvalidOperationException,Compose 只捕获 CapabilityAssemblyException, 导致 RenderFailures 不打 Error 且仅剩失败个数、丢失具体原因。 改为抛 CapabilityAssemblyException:首条为程序集定位信息,其后逐条 保留 LoaderExceptions 的 Message;同步调整扫描失败用例断言。
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🔇 Additional comments: 1
Capability/GameFrameX.Capability.Hosting.Core/CapabilityAssembly.cs: 1
160-160:Trivial · Maintainability & Code Quality · Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.保留原始类型加载异常。
Problems现在保留了加载异常的消息,但此处新建的异常没有保留ReflectionTypeLoadException。调用方因此无法检查原始堆栈或LoaderExceptions中的异常对象。请为CapabilityAssemblyException增加接收内部异常的构造函数,并在此处传入exception;保留现有的Problems输出。根据已检索的经验,重新封装异常时应保留原始异常以支持诊断。Source: Learnings

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
c83262ac-301f-4d33-a1b6-d38f652278b3
Files selected for processing: 2-
Capability/GameFrameX.Capability.Hosting.Core/CapabilityAssembly.csTests/GameFrameX.Tests/Online/CapabilityDeploymentDiscoveryTests.cs
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
-
CapabilityAssemblyException 新增接收内部异常的构造函数,CollectModuleTypes 重新封装时传入原始异常,调用方可检查原始堆栈与 LoaderExceptions 对象; Problems 输出保持不变。
|



变更摘要
CapabilityAssembly.CollectModuleTypes捕获ReflectionTypeLoadException时,由抛InvalidOperationException改为抛CapabilityAssemblyException。Problems首条为ModuleTypeScanFailed定位信息(程序集名 + 失败个数),其后逐条保留每个LoaderExceptions的Message;LoaderExceptions为 null 时按空数组处理。CapabilityAssemblyException新增(problems, innerException)构造函数,重新封装时保留原始ReflectionTypeLoadException(采纳 CodeRabbit 建议),调用方可检查原始堆栈与LoaderExceptions对象。DiscoverModules→DiscoverFromDeploymentDirectory无中间捕获,异常直达CapabilityComposition.Compose的catch (CapabilityAssemblyException),经RenderFailures逐条打 Error 后再抛出。InvalidOperationException,不在本次范围。测试
DiscoverModules_UnloadableTypes_FailsFastWithAssemblyName改为断言CapabilityAssemblyException:首条含程序集名,后续条目含缺失依赖名,InnerException为ReflectionTypeLoadException。dotnet test --filter FullyQualifiedName~GameFrameX.Tests.Online:930 通过 / 0 失败。Compose,传播链经代码阅读确认。