From f568f0e7b50ed1e7012631eeec836f9b3684f46e Mon Sep 17 00:00:00 2001 From: HetCreep Date: Mon, 8 Jun 2026 19:49:39 +0700 Subject: [PATCH] Fix misleading error label for Finished handlers (#1329) BaseChainloader.Execute invoked the Finished event inside the same try/catch that reports plugin-loading failures, so an exception thrown by a Finished event listener was logged as "Error occurred loading plugins:" even though it was unrelated to plugin loading. Move Finished?.Invoke() into its own try/catch with an accurate message. Control flow is otherwise unchanged: Finished still runs only after LoadPlugins succeeds, a throwing listener is still caught, and "Chainloader startup complete" is still logged afterwards. Fixes #842 --- BepInEx.Core/Bootstrap/BaseChainloader.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/BepInEx.Core/Bootstrap/BaseChainloader.cs b/BepInEx.Core/Bootstrap/BaseChainloader.cs index bec5b6b..0776bae 100644 --- a/BepInEx.Core/Bootstrap/BaseChainloader.cs +++ b/BepInEx.Core/Bootstrap/BaseChainloader.cs @@ -315,7 +315,15 @@ public abstract class BaseChainloader var plugins = DiscoverPlugins(); Logger.Log(LogLevel.Info, $"{plugins.Count} plugin{(plugins.Count == 1 ? "" : "s")} to load"); LoadPlugins(plugins); - Finished?.Invoke(); + + try + { + Finished?.Invoke(); + } + catch (Exception ex) + { + Logger.Log(LogLevel.Error, $"Error occurred in a Chainloader.Finished event handler: {ex}"); + } } catch (Exception ex) {