From e0ead8661642821d2d77d81d97d0aefa56b98462 Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Sun, 17 May 2026 08:58:03 +0200 Subject: [PATCH] refactor(di): drop manual PlatformUtil and LogProxy wiring (DI-3) C3's Phase-1 bridge in Plugin.ctor already pulls IPlatformUtil and IPluginLogProxy out of the container right after the host builds, so the manual `new DalamudPlatformUtil()` / `new DalamudPluginLogProxy` assignments in Phase-0 were just allocating throwaway instances that got overwritten a few lines later. Phase-0 helpers that run before the container build (MigrateFromChatTwoLayout, LanguageChanged, ImGuiUtil.Initialize) do not touch Plugin.PlatformUtil or Plugin.LogProxy, so the brief null-window between the schema gate and the container build is safe. The DalamudPlatformUtil and DalamudPluginLogProxy wrapper classes themselves stay in the code; DI-4 (logger migration to ILogger) will eventually retire the proxy for new sites but EmoteCache, AutoTranslate, MemoryUtil and WrapperUtil keep using it. --- HellionChat/Plugin.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/HellionChat/Plugin.cs b/HellionChat/Plugin.cs index cd1bf02..c374464 100755 --- a/HellionChat/Plugin.cs +++ b/HellionChat/Plugin.cs @@ -193,11 +193,11 @@ public sealed class Plugin : IAsyncDalamudPlugin Config = Interface.GetPluginConfig() as Configuration ?? new Configuration(); - // Wire platform indirection before LoadAsync allocates anything that - // needs Util.* — services then read Plugin.PlatformUtil instead of - // hitting the Dalamud static surface directly. - PlatformUtil = new DalamudPlatformUtil(); - LogProxy = new DalamudPluginLogProxy(Log); + // PlatformUtil and LogProxy are filled from the DI container in + // Phase-1 below (`_host.Services.GetRequiredService()` + // and the LogProxy equivalent). Phase-0 helpers that run before that + // point (MigrateFromChatTwoLayout, LanguageChanged, ImGuiUtil.Initialize) + // do not touch either static, so the brief null-window is safe. // Schema gate: v1.4.x requires config v16+. Users on older schemas // must install v1.4.2 first to run the migration chain. v17 adds