Skip to content

Commit 1d3f86d

Browse files
authored
Merge branch 'dev' into dependency_injection_code_quality
2 parents 84954be + 79d54d0 commit 1d3f86d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ public static class PluginManager
2828
public static List<PluginPair> AllPlugins { get; private set; }
2929
public static readonly HashSet<PluginPair> GlobalPlugins = new();
3030
public static readonly Dictionary<string, PluginPair> NonGlobalPlugins = new();
31-
32-
private static readonly IPublicAPI _api = Ioc.Default.GetRequiredService<IPublicAPI>();
31+
32+
// We should not initialize API in static constructor because it will create another API instance
33+
private static IPublicAPI api = null;
34+
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
3335

3436
private static PluginsSettings Settings;
3537
private static List<PluginMetadata> _metadatas;

0 commit comments

Comments
 (0)