Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error occurred loading plugins:" text prepended to exceptions raised by listeners of the BaseChainloader.Finished event can be misleading #842

Open
ReveredRedHood opened this issue Apr 22, 2024 · 0 comments
Labels
error Error message or log that may need investigation needs-replication Issue needs to be replicated by BepInEx dev

Comments

@ReveredRedHood
Copy link

What happened?

I'm working on a BepInEx plugin for Bleeding Edge 667 designed to provide helper functions for mod authors. However, this problem seems to still exist in the master branch (which is why I've marked it as applying to Stable).

After adding a listener to BaseChainloader.Finished, if the listener throws an exception during its execution after BaseChainloader.Finished is invoked, the exception message will be prepended with "Error occurred loading plugins:" even though the error is not necessarily related to plugin loading. This happens because the Invoke statement is in the try-catch block 1. It can be addressed by either taking the Invoke statement out of the block or by adding checks in the catch statement to ensure the problem is related to plugin loading instead of to an unrelated listener that happens to run after the Finished event is invoked.

You can find more context regarding the log output here: https://github.com/ReveredRedHood/SOD.Common_Fork/blob/feature/plugindetectionhelpers/SOD.Common/Helpers/PluginDetection.cs#L60.

BepInEx Distribution

Stable from GitHub

Log outputs

[Error  :   BepInEx] Error occurred loading plugins: System.Collections.Generic.KeyNotFoundException: Plugin GUID (example-that-fails) not found.
   at SOD.Common.Helpers.PluginDetection.GetPluginInfo(String pluginGuid) in C:\Users\Personal\Documents\repos\SOD.Common\SOD.Common\Helpers\PluginDetection.cs:line 99
   at SOD.Common.Helpers.PluginDetection.GetPluginConfigEntryValue[T](String pluginGuid, String section, String key) in C:\Users\Personal\Documents\repos\SOD.Common\SOD.Common\Helpers\PluginDetection.cs:line 120
   at TestHelper.Plugin.DetectPluginsFails(Object sender, EventArgs e) in C:\Users\Personal\Documents\repos\MySODMods\mods\TestHelper\Plugin.cs:line 62
   at SOD.Common.Helpers.PluginDetection.OnAllPluginsFinishedLoadingListener() in C:\Users\Personal\Documents\repos\SOD.Common\SOD.Common\Helpers\PluginDetection.cs:line 33
   at BepInEx.Bootstrap.BaseChainloader`1.Execute() in /home/runner/work/BepInEx/BepInEx/BepInEx.Core/Bootstrap/BaseChainloader.cs:line 318

Environment

- OS: Windows 10 64-bit
- BepInEx: 6.0.0-be.667 built from commit 6b500b35727716f8ba182dedae304a628dbbb608
- Game: Shadows of Doubt

Footnotes

  1. https://github.com/BepInEx/BepInEx/blob/49015217f3becf052d33fa4658ac19229f5daa3a/BepInEx.Core/Bootstrap/BaseChainloader.cs#L318

@ReveredRedHood ReveredRedHood added error Error message or log that may need investigation needs-replication Issue needs to be replicated by BepInEx dev labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error Error message or log that may need investigation needs-replication Issue needs to be replicated by BepInEx dev
Projects
None yet
Development

No branches or pull requests

1 participant