@@ -37,7 +37,7 @@ public static class PluginManager
3737
3838 private static PluginsSettings Settings ;
3939 private static List < PluginMetadata > _metadatas ;
40- private static List < string > _modifiedPlugins = new ( ) ;
40+ private static readonly List < string > _modifiedPlugins = new ( ) ;
4141
4242 /// <summary>
4343 /// Directories that will hold Flow Launcher plugin directory
@@ -61,10 +61,17 @@ private static void DeletePythonBinding()
6161 /// </summary>
6262 public static void Save ( )
6363 {
64- foreach ( var plugin in AllPlugins )
64+ foreach ( var pluginPair in AllPlugins )
6565 {
66- var savable = plugin . Plugin as ISavable ;
67- savable ? . Save ( ) ;
66+ var savable = pluginPair . Plugin as ISavable ;
67+ try
68+ {
69+ savable ? . Save ( ) ;
70+ }
71+ catch ( Exception e )
72+ {
73+ API . LogException ( ClassName , $ "Failed to save plugin { pluginPair . Metadata . Name } ", e ) ;
74+ }
6875 }
6976
7077 API . SavePluginSettings ( ) ;
@@ -81,14 +88,21 @@ public static async ValueTask DisposePluginsAsync()
8188
8289 private static async Task DisposePluginAsync ( PluginPair pluginPair )
8390 {
84- switch ( pluginPair . Plugin )
91+ try
92+ {
93+ switch ( pluginPair . Plugin )
94+ {
95+ case IDisposable disposable :
96+ disposable . Dispose ( ) ;
97+ break ;
98+ case IAsyncDisposable asyncDisposable :
99+ await asyncDisposable . DisposeAsync ( ) ;
100+ break ;
101+ }
102+ }
103+ catch ( Exception e )
85104 {
86- case IDisposable disposable :
87- disposable . Dispose ( ) ;
88- break ;
89- case IAsyncDisposable asyncDisposable :
90- await asyncDisposable . DisposeAsync ( ) ;
91- break ;
105+ API . LogException ( ClassName , $ "Failed to dispose plugin { pluginPair . Metadata . Name } ", e ) ;
92106 }
93107 }
94108
@@ -292,7 +306,7 @@ public static async Task<List<Result>> QueryForPluginAsync(PluginPair pair, Quer
292306 {
293307 Title = $ "{ metadata . Name } : Failed to respond!",
294308 SubTitle = "Select this result for more info" ,
295- IcoPath = Flow . Launcher . Infrastructure . Constant . ErrorIcon ,
309+ IcoPath = Constant . ErrorIcon ,
296310 PluginDirectory = metadata . PluginDirectory ,
297311 ActionKeywordAssigned = query . ActionKeyword ,
298312 PluginID = metadata . ID ,
@@ -369,8 +383,8 @@ public static bool ActionKeywordRegistered(string actionKeyword)
369383 {
370384 // this method is only checking for action keywords (defined as not '*') registration
371385 // hence the actionKeyword != Query.GlobalPluginWildcardSign logic
372- return actionKeyword != Query . GlobalPluginWildcardSign
373- && NonGlobalPlugins . ContainsKey ( actionKeyword ) ;
386+ return actionKeyword != Query . GlobalPluginWildcardSign
387+ && NonGlobalPlugins . ContainsKey ( actionKeyword ) ;
374388 }
375389
376390 /// <summary>
0 commit comments