Skip to content

Commit dbe2151

Browse files
committed
Clean up exception throwing code for plugin loading
1 parent b38ffef commit dbe2151

File tree

3 files changed

+890
-10
lines changed

3 files changed

+890
-10
lines changed

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ public static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source)
4040
var milliseconds = Stopwatch.Debug(
4141
$"|PluginsLoader.DotNetPlugins|Constructor init cost for {metadata.Name}", () =>
4242
{
43-
#if DEBUG
44-
var assemblyLoader = new PluginAssemblyLoader(metadata.ExecuteFilePath);
45-
var assembly = assemblyLoader.LoadAssemblyAndDependencies();
46-
var type = assemblyLoader.FromAssemblyGetTypeOfInterface(assembly,
47-
typeof(IAsyncPlugin));
48-
#pragma warning disable IDE0019 // "Use Pattern Matching" - disabled because the pattern is useful for RELEASE
49-
var plugin = Activator.CreateInstance(type) as IAsyncPlugin;
50-
#pragma warning restore IDE0019
51-
52-
#else
5343
Assembly assembly = null;
5444
IAsyncPlugin plugin = null;
5545

@@ -63,6 +53,12 @@ public static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source)
6353

6454
plugin = Activator.CreateInstance(type) as IAsyncPlugin;
6555
}
56+
#if DEBUG
57+
catch (Exception e)
58+
{
59+
throw;
60+
}
61+
#else
6662
catch (Exception e) when (assembly == null)
6763
{
6864
Log.Exception($"|PluginsLoader.DotNetPlugins|Couldn't load assembly for the plugin: {metadata.Name}", e);
@@ -80,6 +76,7 @@ public static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source)
8076
Log.Exception($"|PluginsLoader.DotNetPlugins|The following plugin has errored and can not be loaded: <{metadata.Name}>", e);
8177
}
8278
#endif
79+
8380
if (plugin == null)
8481
{
8582
erroredPlugins.Add(metadata.Name);

0 commit comments

Comments
 (0)