• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

AAEmu / AAEmu / 22347723353

24 Feb 2026 10:54AM UTC coverage: 6.056% (+1.1%) from 4.943%
22347723353

push

github

web-flow
feat: Migrate manager singletons to DI for testing and parallel loading (#1363)

* feat(game): Add DI bridge and extract interfaces for all managers

- Modify Singleton<T>.Instance to resolve from DI when SingletonContainer.ServiceProvider
  is set, falling back to reflection (zero-cost after first hit via _instance cache)
- Add SingletonContainer static class to AAEmu.Commons to hold IServiceProvider
- Wire IServiceProvider into GameService constructor to set SingletonContainer at startup
- Extract IXyzManager interfaces for all ~60 Singleton<T>-based managers and
  IXyzIdManager interfaces for all 25 IdManagers (plus shared IIdManager base)
- Register every manager in Program.cs ConfigureServices with both concrete type
  and interface forward (IdManagers use factory pattern via their static Instance)

Backwards-compatible: Singleton<T> reflection path is unchanged when ServiceProvider
is null (Login server and unit tests are unaffected). All 380 unit tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(game): Phase 2 — constructor DI for simple managers (1-3 deps)

Migrates 7 Game managers to primary-constructor dependency injection,
adds a Singleton guard, and ships 8 new unit test files.

Managers migrated:
- TaskManager       ← ITickManager
- FactionManager    ← ILocalizationManager
- ManaRegenManager  ← ITickManager
- SkillManager      ← IAnimationManager, IPlotManager
- QuestManager      ← ITaskManager, IZoneManager (partial class)
- EffectTaskManager ← ITaskManager (static AddDispelTask → instance)
- SusManager        ← IWorldManager

Interface changes:
- IEffectTaskManager: add AddDispelTask(Buff, double)
- IWorldManager: add GetCharacterByObjId(uint)

Singleton guard: OnInit() now throws InvalidOperationException with
a clear message when a type has no parameterless constructor (public
or non-public), replacing an opaque MissingMethodException.

Also fixes GameServiceTests broken by Phase 1 (needs IServiceProvider)... (continued)

675 of 1352 new or added lines in 148 files covered. (49.93%)

34 existing lines in 12 files now uncovered.

4154 of 68594 relevant lines covered (6.06%)

0.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/AAEmu.Game/Program.cs


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc