From 8cfd58bb7e25c4476d21cee2d06e4420022b02e7 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 8 Apr 2021 14:21:32 -0600 Subject: [PATCH] Fix error printing for plugin loading --- .../Plugins/PluginLoader.cs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs index c0aac87d..7192c667 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs @@ -358,7 +358,19 @@ namespace PepperDash.Essentials try { var assy = loadedAssembly.Assembly; - var types = assy.GetTypes(); + CType[] types = {}; + try + { + types = assy.GetTypes(); + } + catch (TypeLoadException e) + { + Debug.Console(0, Debug.ErrorLogLevel.Warning, "Unable to get types for assembly {0}: {1}", + loadedAssembly.Name, e.Message); + Debug.Console(2, e.StackTrace); + continue; + } + foreach (var type in types) { try @@ -382,7 +394,7 @@ namespace PepperDash.Essentials catch (NotSupportedException e) { //this happens for dlls that aren't PD dlls, like ports of Mono classes into S#. Swallowing. - + } catch (Exception e) { @@ -392,12 +404,6 @@ namespace PepperDash.Essentials } } - catch (TypeLoadException e) - { - Debug.Console(0, Debug.ErrorLogLevel.Warning, "Unable to load assembly {0}: {1}", - loadedAssembly.Name, e.Message); - Debug.Console(2, e.StackTrace); - } catch (Exception e) { Debug.Console(0, Debug.ErrorLogLevel.Warning, "Error Loading assembly {0}: {1}",