mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-14 06:34:30 +08:00
- 修复 MicrosoftDiContainer 的 IDisposable 释放逻辑、根 ServiceProvider 清理与释放后访问保护 - 更新 CQRS benchmarks 的容器 cleanup,并补齐 RequestStartupBenchmarks 的冷启动容器释放路径 - 补充 Core 容器生命周期回归测试并归档 issue 327 的 ai-plan topic
2.3 KiB
2.3 KiB
MicrosoftDiContainer Disposal Tracking
Goal
Fix issue #327 by making MicrosoftDiContainer explicitly disposable, ensuring frozen service providers and lock
state are released deterministically, and updating CQRS benchmarks so every owned container is disposed in cleanup or
cold-start paths.
Current Recovery Point
- Recovery point:
MDC-DISPOSE-RP-001 - Phase: completed and ready to archive
- Focus:
- keep the final validated implementation and archive handoff concise
Active Risks
- No active implementation blockers remain after validation.
Completed In This Stage
- Extended
IIocContainerto inheritIDisposableso callers holding the abstraction can release container-owned resources explicitly. - Implemented
MicrosoftDiContainer.Dispose()with idempotent root-provider release, lock cleanup, state clearing, andObjectDisposedExceptionguards for post-disposal access. - Updated
Clear()to dispose the currently built root provider before resetting container state. - Added Core regression tests that verify resolved DI-owned singletons are disposed and that disposed containers reject further registration, lookup, and scope creation.
- Fixed CQRS benchmark cleanup so every benchmark-owned
MicrosoftDiContaineris disposed, including the temporary cold-start container path inRequestStartupBenchmarks.
Validation Target
python3 scripts/license-header.py --checkdotnet test GFramework.Core.Tests -c Release --filter "FullyQualifiedName~MicrosoftDiContainer|FullyQualifiedName~IocContainerLifetimeTests"dotnet build GFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csproj -c Releasedotnet build GFramework.sln -c Release
Latest Validation Result
python3 scripts/license-header.py --checkpassed on 2026-05-06.dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~MicrosoftDiContainer|FullyQualifiedName~IocContainerLifetimeTests"passed on 2026-05-06 with55tests passed.dotnet build GFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csproj -c Releasepassed on 2026-05-06 with0 warningsand0 errors.dotnet build GFramework.sln -c Releasepassed on 2026-05-06 with0 warningsand0 errors.
Next Recommended Resume Step
Archive this topic under ai-plan/public/archive/ and push the fix branch for review.