Skip to content

Commit 960593e

Browse files
committed
Add handling of reflection type error
1 parent 26e06f7 commit 960593e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Flow.Launcher.Core/Plugin/PluginsLoader.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
@@ -53,17 +53,25 @@ public static IEnumerable<PluginPair> DotNetPlugins(List<PluginMetadata> source)
5353
Log.Exception($"|PluginsLoader.DotNetPlugins|Couldn't load assembly for {metadata.Name}", e);
5454
return;
5555
}
56-
var types = assembly.GetTypes();
56+
5757
Type type;
5858
try
5959
{
60+
var types = assembly.GetTypes();
61+
6062
type = types.First(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IPlugin)));
6163
}
6264
catch (InvalidOperationException e)
6365
{
6466
Log.Exception($"|PluginsLoader.DotNetPlugins|Can't find class implement IPlugin for <{metadata.Name}>", e);
6567
return;
6668
}
69+
catch (ReflectionTypeLoadException e)
70+
{
71+
Log.Exception($"|PluginsLoader.DotNetPlugins|The GetTypes method was unable to load assembly types for <{metadata.Name}>", e);
72+
return;
73+
}
74+
6775
IPlugin plugin;
6876
try
6977
{

0 commit comments

Comments
 (0)