diff --git a/Changelog/2026-10-04-plugin-render-snapshot-fix-and-imgui-diagnostics.md b/Changelog/2026-10-04-plugin-render-snapshot-fix-and-imgui-diagnostics.md
new file mode 100644
index 0000000..e8b2b20
--- /dev/null
+++ b/Changelog/2026-10-04-plugin-render-snapshot-fix-and-imgui-diagnostics.md
@@ -0,0 +1,34 @@
+# Plugin render snapshot fix and ImGui pipeline diagnostics (2026-10-04)
+
+Ships in installer 2026.10.4.15.
+
+## Fix: plugin overlay windows never drew (ILT Hub not showing)
+
+`PluginManager.RenderAll` and `RenderOverlayAll` iterate `_pluginsRenderSnapshot`, a
+copy of the plugin list published by `PublishPluginsRenderSnapshot()`. Since the aelrynth
+2026.9.27.2 snapshot port (commit 4ddbb52e), the publish call that belonged at the end of
+`LoadPluginsFromDisk()` had landed after the `return` in `TryGetCanonicalPath()`, where it
+could never run. The only publish that ran was in `UnloadAllPlugins()`, which published an
+empty list. The result was that every plugin's ImGui render and overlay callbacks were
+skipped, so windows like the RynthAi ILT Hub never appeared even though `hub show` worked.
+
+- `LoadPluginsFromDisk()` now publishes the snapshot after loading and logs the plugin count.
+- The unreachable call has been removed.
+- `RynthCore.Engine.csproj` now treats CS0162 (unreachable code) as a build error, so a
+ misplaced statement like this one fails the build.
+
+## Diagnostics: per-frame ImGui pipeline
+
+All of these lines appear in the normal log at Info, and each is written once (or when its value changes):
+
+- `reached ImGui gate (EnableImGuiBackend, EnableImGuiShell, EnablePluginOverlayWindows)`.
+- ImGui init: success, or an Error naming the failing step (EnsureCore, Win32Backend.Init,
+ DX9Backend.InitImGui), and an Error if frames are skipped because init failed.
+- `first ImGui frame started` with the display size, and `first deferred ImGui draw submitted`.
+- Which branch the frame took (shell, overlay or none), logged when it changes.
+- `RenderOverlayAll`: waiting for login, then `login seen, N of M plugin(s) will draw overlay windows`
+ with each plugin's state (overlay / no-overlay, not-init, failed).
+- A heartbeat every 30 s: frames completed, draws submitted, last-frame draw lists and vertices,
+ overlay calls, login seen, overlay plugin count.
+- Engine-frame and ImGui-frame exceptions: the first one is logged as an Error with the full exception,
+ then a count every 30 s instead of one line per frame.
diff --git a/src/RynthCore.Engine/ImGui/EngineFrameController.cs b/src/RynthCore.Engine/ImGui/EngineFrameController.cs
index de3fa36..35c030f 100644
--- a/src/RynthCore.Engine/ImGui/EngineFrameController.cs
+++ b/src/RynthCore.Engine/ImGui/EngineFrameController.cs
@@ -78,6 +78,24 @@ internal static class EngineFrameController
// (after the Avalonia blit). Render thread only. Device == 0 means nothing pending.
private static ImDrawDataPtr _deferredDrawData;
private static IntPtr _deferredDrawDevice;
+
+ // ImGui pipeline diagnostics (render thread only): one-time lines plus a 30 s heartbeat so a
+ // log shows whether frames start, which branch runs and whether draw data is submitted.
+ private const long HeartbeatIntervalMs = 30_000;
+ private static bool _loggedImGuiGate;
+ private static long _engineErrorCount;
+ private static long _imguiErrorCount;
+ private static long _nextImGuiErrorLogAt;
+ private static long _nextEngineErrorLogAt;
+ private static bool _loggedInitFailedSkip;
+ private static bool _loggedFirstFrame;
+ private static bool _loggedFirstSubmit;
+ private static int _loggedBranch = -1;
+ private static string _initFailStep = "unknown";
+ private static long _framesCompleted;
+ private static long _drawSubmits;
+ private static long _nextHeartbeatAt;
+
private static long _lastFrameTicks;
private static int _frameCount;
@@ -118,7 +136,10 @@ internal static class EngineFrameController
return true;
if (!EnsureCore(pDevice))
+ {
+ _initFailStep = "EnsureCore (game window not found)";
return false;
+ }
IntPtr previousContext = ImGuiNET.ImGui.GetCurrentContext();
if (previousContext != IntPtr.Zero)
@@ -141,7 +162,7 @@ internal static class EngineFrameController
System.IO.Directory.CreateDirectory(RynthInstallPaths.RynthAiDir);
IntPtr iniPtr = System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(iniPath);
unsafe { io.NativePtr->IniFilename = (byte*)iniPtr; }
- RynthLog.Render($"EngineFrameController: imgui.ini pinned to {iniPath}");
+ RynthLog.Info($"EngineFrameController: imgui.ini pinned to {iniPath}");
}
catch (Exception ex)
{
@@ -168,10 +189,16 @@ internal static class EngineFrameController
ViewportProbe.Run();
if (!Win32Backend.Init(_gameHwnd))
+ {
+ _initFailStep = "Win32Backend.Init";
return false;
+ }
if (!DX9Backend.InitImGui(pDevice))
+ {
+ _initFailStep = "DX9Backend.InitImGui";
return false;
+ }
// Viewport backends only run when ViewportsEnable is on. Installing
// their callbacks on PlatformIO without the flag has no upside and
@@ -192,7 +219,7 @@ internal static class EngineFrameController
_imguiInitialized = true;
initSucceeded = true;
- RynthLog.Render("EngineFrameController: Fully initialized - RynthCore shell active.");
+ RynthLog.Info("EngineFrameController: ImGui fully initialized.");
return true;
}
finally
@@ -369,6 +396,12 @@ internal static class EngineFrameController
// calls it at all.
// ── ImGui-gated work ─────────────────────────────────────────
+ if (!_loggedImGuiGate)
+ {
+ // Reaching here proves the always-on steps above aren't throwing every frame.
+ _loggedImGuiGate = true;
+ RynthLog.Info($"EngineFrameController: reached ImGui gate (EnableImGuiBackend={Plugins.EngineSettings.EnableImGuiBackend}, EnableImGuiShell={Plugins.EngineSettings.EnableImGuiShell}, EnablePluginOverlayWindows={Plugins.EngineSettings.EnablePluginOverlayWindows}).");
+ }
if (Plugins.EngineSettings.EnableImGuiBackend)
RunImGuiFrame(pDevice);
@@ -388,7 +421,16 @@ internal static class EngineFrameController
}
catch (Exception ex)
{
- RynthLog.Info($"EngineFrameController: frame {_frameCount} engine error: {ex.GetType().Name}: {ex.Message}");
+ // An exception here skips everything after it this frame (including RunImGuiFrame), so
+ // the first one gets a stack trace; repeats are summarised every 30 s instead of per frame.
+ _engineErrorCount++;
+ long errNow = Environment.TickCount64;
+ if (_engineErrorCount == 1)
+ RynthLog.Error($"EngineFrameController: engine frame error (rest of this frame skipped): {ex}");
+ else if (errNow >= _nextEngineErrorLogAt)
+ RynthLog.Error($"EngineFrameController: engine frame errors so far={_engineErrorCount}, latest {ex.GetType().Name}: {ex.Message}");
+ if (errNow >= _nextEngineErrorLogAt)
+ _nextEngineErrorLogAt = errNow + HeartbeatIntervalMs;
}
finally
{
@@ -454,13 +496,22 @@ internal static class EngineFrameController
///
private static void RunImGuiFrame(IntPtr pDevice)
{
- if (_imguiInitFailed) return;
+ if (_imguiInitFailed)
+ {
+ if (!_loggedInitFailedSkip)
+ {
+ _loggedInitFailedSkip = true;
+ RynthLog.Error("EngineFrameController: ImGui init failed earlier - RunImGuiFrame is a no-op for this session (no plugin overlay windows).");
+ }
+ return;
+ }
if (!_imguiInitialized)
{
if (!Init(pDevice))
{
_imguiInitFailed = true;
+ RynthLog.Error($"EngineFrameController: ImGui init FAILED at step '{_initFailStep}' - ImGui frames disabled for this session.");
return;
}
}
@@ -516,21 +567,39 @@ internal static class EngineFrameController
ImGuiNET.ImGui.NewFrame();
frameStarted = true;
+ if (!_loggedFirstFrame)
+ {
+ _loggedFirstFrame = true;
+ RynthLog.Info($"EngineFrameController: first ImGui frame started (frame={_frameCount}, display={io.DisplaySize.X:0}x{io.DisplaySize.Y:0}).");
+ }
+
// EnableImGuiShell gates the in-AC ImGui surface as a whole: both the
// RynthCore overlay bar and any plugin-drawn ImGui windows. Plugins
// still load, init, and tick when this is off — they just don't
// draw, so Avalonia panels can drive them via the plugin's C exports.
+ int branch;
if (Plugins.EngineSettings.EnableImGuiShell)
{
+ branch = 1;
RynthCoreShell.Render(_frameCount);
PluginManager.RenderAll();
}
else if (Plugins.EngineSettings.EnablePluginOverlayWindows)
{
+ branch = 2;
// Avalonia mode: only the opt-in extra windows (RynthPluginRenderOverlay),
// never the plugins' full ImGui UIs that Avalonia panels already cover.
PluginManager.RenderOverlayAll();
}
+ else
+ {
+ branch = 0;
+ }
+ if (branch != _loggedBranch)
+ {
+ _loggedBranch = branch;
+ RynthLog.Info($"EngineFrameController: ImGui branch = {(branch == 1 ? "shell (RenderAll)" : branch == 2 ? "overlay windows (RenderOverlayAll)" : "none (shell and overlay windows both off)")}.");
+ }
bool captureMouse =
ImGuiNET.ImGui.IsWindowHovered(ImGuiHoveredFlags.AnyWindow) ||
@@ -550,6 +619,8 @@ internal static class EngineFrameController
// Avalonia panels. The draw data stays valid until the next NewFrame.
_deferredDrawData = drawData;
_deferredDrawDevice = pDevice;
+ _framesCompleted++;
+ LogHeartbeatIfDue(drawData);
if ((io.ConfigFlags & ImGuiConfigFlags.ViewportsEnable) != 0)
{
@@ -569,7 +640,14 @@ internal static class EngineFrameController
{
}
- RynthLog.Info($"EngineFrameController: frame {_frameCount} ImGui error: {ex.GetType().Name}: {ex.Message}");
+ _imguiErrorCount++;
+ long errNow = Environment.TickCount64;
+ if (_imguiErrorCount == 1)
+ RynthLog.Error($"EngineFrameController: ImGui frame error at frame {_frameCount} (frameStarted={frameStarted}): {ex}");
+ else if (errNow >= _nextImGuiErrorLogAt)
+ RynthLog.Error($"EngineFrameController: ImGui frame errors so far={_imguiErrorCount}, latest {ex.GetType().Name}: {ex.Message}");
+ if (errNow >= _nextImGuiErrorLogAt)
+ _nextImGuiErrorLogAt = errNow + HeartbeatIntervalMs;
}
finally
{
@@ -595,6 +673,12 @@ internal static class EngineFrameController
try
{
DX9Backend.RenderDrawData(_deferredDrawData, device);
+ _drawSubmits++;
+ if (!_loggedFirstSubmit)
+ {
+ _loggedFirstSubmit = true;
+ RynthLog.Info("EngineFrameController: first deferred ImGui draw submitted (after the Avalonia layer).");
+ }
}
catch (Exception ex)
{
@@ -606,6 +690,29 @@ internal static class EngineFrameController
}
}
+ ///
+ /// Every 30 s: completed ImGui frames, deferred submits, draw list / vertex counts of the
+ /// latest frame and the overlay-window stats from PluginManager. Zero draw lists means no
+ /// ImGui window was drawn that frame. One string per interval; no per-frame allocation.
+ ///
+ private static void LogHeartbeatIfDue(ImDrawDataPtr drawData)
+ {
+ long now = Environment.TickCount64;
+ if (now < _nextHeartbeatAt) return;
+ bool first = _nextHeartbeatAt == 0;
+ _nextHeartbeatAt = now + HeartbeatIntervalMs;
+ if (first) return; // first interval starts now; the first-frame line already covers t=0
+
+ int lists = 0, vertices = 0;
+ unsafe
+ {
+ // ImDrawData: +4 CmdListsCount, +8 TotalIdxCount, +12 TotalVtxCount (see CLAUDE.md offsets).
+ byte* p = (byte*)drawData.NativePtr;
+ if (p != null) { lists = *(int*)(p + 4); vertices = *(int*)(p + 12); }
+ }
+ RynthLog.Info($"EngineFrameController: ImGui heartbeat frames={_framesCompleted} submits={_drawSubmits} lastFrame drawLists={lists} vertices={vertices} {PluginManager.DescribeOverlayState()}.");
+ }
+
internal static IntPtr FindGameWindow()
{
uint pid = GetCurrentProcessId();
diff --git a/src/RynthCore.Engine/Plugins/PluginManager.cs b/src/RynthCore.Engine/Plugins/PluginManager.cs
index e094271..b56305c 100644
--- a/src/RynthCore.Engine/Plugins/PluginManager.cs
+++ b/src/RynthCore.Engine/Plugins/PluginManager.cs
@@ -1053,10 +1053,45 @@ internal static class PluginManager
///
public static void RenderOverlayAll()
{
+ _overlayCalls++;
if (!_loginCompleteObserved)
+ {
+ if (!_loggedOverlayWaitingForLogin)
+ {
+ _loggedOverlayWaitingForLogin = true;
+ RynthLog.Info("PluginManager: RenderOverlayAll called - waiting for login before drawing overlay windows.");
+ }
return; // same not-in-world crash zone guard as RenderAll
+ }
LoadedPlugin[] plugins = System.Threading.Volatile.Read(ref _pluginsRenderSnapshot);
+
+ // Count plugins that will actually be called; log whenever that set changes.
+ int bound = 0;
+ for (int i = 0; i < plugins.Length; i++)
+ {
+ var p = plugins[i];
+ if (p.Initialized && !p.Failed && p.RenderOverlay != null) bound++;
+ }
+ _overlayBound = bound;
+ if (bound != _loggedOverlayBound || plugins.Length != _loggedOverlayTotal)
+ {
+ _loggedOverlayBound = bound;
+ _loggedOverlayTotal = plugins.Length;
+ var sb = new System.Text.StringBuilder();
+ for (int i = 0; i < plugins.Length; i++)
+ {
+ var p = plugins[i];
+ if (sb.Length > 0) sb.Append(", ");
+ sb.Append(p.DisplayName).Append('(')
+ .Append(p.RenderOverlay != null ? "overlay" : "no-overlay")
+ .Append(p.Initialized ? "" : ",not-init")
+ .Append(p.Failed ? ",failed" : "")
+ .Append(')');
+ }
+ RynthLog.Info($"PluginManager: RenderOverlayAll login seen, {bound} of {plugins.Length} plugin(s) will draw overlay windows: {sb}.");
+ }
+
for (int i = 0; i < plugins.Length; i++)
{
var plugin = plugins[i];
@@ -1083,6 +1118,17 @@ internal static class PluginManager
}
}
+ // RenderOverlayAll diagnostics (render thread only).
+ private static long _overlayCalls;
+ private static int _overlayBound;
+ private static bool _loggedOverlayWaitingForLogin;
+ private static int _loggedOverlayBound = -1;
+ private static int _loggedOverlayTotal = -1;
+
+ /// Overlay stats for the ImGui heartbeat line.
+ internal static string DescribeOverlayState()
+ => $"overlayCalls={_overlayCalls} loginSeen={_loginCompleteObserved} overlayPlugins={_overlayBound}";
+
public static void ShutdownAll()
{
RynthLog.Plugin($"PluginManager: Shutting down {_plugins.Count} plugin(s)...");
@@ -2174,6 +2220,10 @@ internal static class PluginManager
TryAddCanonicalPath(loadedCanonicalPaths, plugin.SourceFilePath);
}
}
+
+ // RenderAll / RenderOverlayAll iterate only this snapshot; without it they see no plugins.
+ PublishPluginsRenderSnapshot();
+ RynthLog.Plugin($"PluginManager: render snapshot published ({_plugins.Count} plugin(s)).");
}
private static void TryAddCanonicalPath(HashSet set, string path)
@@ -2194,8 +2244,6 @@ internal static class PluginManager
canonical = string.Empty;
return false;
}
-
- PublishPluginsRenderSnapshot();
}
private static void InitializeLoadedPlugins()
diff --git a/src/RynthCore.Engine/RynthCore.Engine.csproj b/src/RynthCore.Engine/RynthCore.Engine.csproj
index d412cd7..95226b3 100644
--- a/src/RynthCore.Engine/RynthCore.Engine.csproj
+++ b/src/RynthCore.Engine/RynthCore.Engine.csproj
@@ -6,6 +6,9 @@
win-x86
Library
true
+
+ $(WarningsAsErrors);CS0162
enable
true
Shared