From cf5ef80c08d81ae346854de0702d77500f2af620 Mon Sep 17 00:00:00 2001 From: HueByte Date: Thu, 19 Feb 2026 13:48:26 +0100 Subject: [PATCH] feat: Enhance diagnostic logging for service resolution during startup --- src/EchoHub.Server/Program.cs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/EchoHub.Server/Program.cs b/src/EchoHub.Server/Program.cs index 78a066f..17c7b85 100644 --- a/src/EchoHub.Server/Program.cs +++ b/src/EchoHub.Server/Program.cs @@ -202,8 +202,28 @@ while (true) } }, heartbeatCts.Token); - // ── Enumerate hosted services (DI resolution) ──────────────────── - Console.Error.WriteLine("[DIAG] Resolving IHostedService instances from DI..."); + // ── Resolve singletons one-by-one to find which one hangs ──────── + Console.Error.WriteLine("[DIAG] Resolving PresenceTracker..."); + _ = app.Services.GetRequiredService(); + Console.Error.WriteLine("[DIAG] PresenceTracker OK."); + + Console.Error.WriteLine("[DIAG] Resolving JwtTokenService..."); + _ = app.Services.GetRequiredService(); + Console.Error.WriteLine("[DIAG] JwtTokenService OK."); + + Console.Error.WriteLine("[DIAG] Resolving FileStorageService..."); + _ = app.Services.GetRequiredService(); + Console.Error.WriteLine("[DIAG] FileStorageService OK."); + + Console.Error.WriteLine("[DIAG] Resolving IChatBroadcaster..."); + _ = app.Services.GetServices().ToList(); + Console.Error.WriteLine("[DIAG] IChatBroadcaster OK."); + + Console.Error.WriteLine("[DIAG] Resolving IChatService..."); + _ = app.Services.GetRequiredService(); + Console.Error.WriteLine("[DIAG] IChatService OK."); + + Console.Error.WriteLine("[DIAG] Resolving IHostedService instances..."); var hostedServices = app.Services.GetServices().ToList(); Console.Error.WriteLine($"[DIAG] Found {hostedServices.Count} hosted services:"); foreach (var svc in hostedServices)