Flow-Launcher/Flow.Launcher

BUG: Plugins Loading Different Versions of Same Dependency Causes Init Failure

Open

#4,258 创建于 2026年2月8日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)C# (14,678 star) (598 fork)batch import
bughelp wantedkeep-fresh

描述

Checks

  • I have checked that this issue has not already been reported.

  • I am using the latest version of Flow Launcher.

  • I am using the prerelease version of Flow Launcher.

Problem Description

When two plugins use the same dependency but with different versions, it can break one of the plugins.

This seems to be due to two DLLs being loaded and in my specific case it seems to try to cast a matching class between the different dependency versions and crash.

This issue was first reported on my plugin AppAudioManger here: https://github.com/DavidGBrett/Flow.Launcher.Plugin.AppAudioManager/issues/8 by @Jack251970

The other conflicting plugin was AudioDeviceSelector: https://github.com/attilakapostyak/Flow.Launcher.Plugin.AudioDeviceSelector

In this case my plugin was using NAudio version 2.2.1, while AudioDeviceSelector was using 2.1.0

From my brief research, you may be able to fix this by isolating the plugins / their dependencies using: System.Runtime.Loader.AssemblyLoadContext

Though I don't know enough about that to be certain.

To Reproduce

  1. pm install AppAudioManger
  2. pm install AudioDeviceSelector

Screenshots

No response

Flow Launcher Version

2.0.3

Windows Build Number

26200.7705

Error Log


18:57:23.8853+01:00 - ERROR - PluginManager.InitializePluginsAsync - Fail to Init plugin: Audio Device Selector
EXCEPTION OCCURS: System.InvalidCastException: Unable to cast object of type 'NAudio.CoreAudioApi.Interfaces.MMDeviceEnumeratorComObject' to type 'NAudio.CoreAudioApi.Interfaces.MMDeviceEnumeratorComObject'.
   at new NAudio.CoreAudioApi.MMDeviceEnumerator()
   at new Flow.Launcher.Plugin.AudioDeviceSelector.Audio.AudioDevicesManager() in D:/a/Flow.Launcher.Plugin.AudioDeviceSelector/Flow.Launcher.Plugin.AudioDeviceSelector/src/Flow.Launcher.Plugin.AudioDeviceSelector/Audio/AudioDevicesManager.cs:line 17
   at void Flow.Launcher.Plugin.AudioDeviceSelector.Main.Init(PluginInitContext context) in D:/a/Flow.Launcher.Plugin.AudioDeviceSelector/Flow.Launcher.Plugin.AudioDeviceSelector/src/Flow.Launcher.Plugin.AudioDeviceSelector/Main.cs:line 162
   at Task Flow.Launcher.Plugin.IPlugin.Flow.Launcher.Plugin.IAsyncPlugin.InitAsync(PluginInitContext context)+() => { } in /_/Flow.Launcher.Plugin/Interfaces/IPlugin.cs:line 33
   at async Task<long> Flow.Launcher.Infrastructure.Stopwatch.DebugAsync(string className, string message, Func<Task> action, string methodName) in C:/projects/flow-launcher/Flow.Launcher.Infrastructure/Stopwatch.cs:line 31
   at async Task Flow.Launcher.Core.Plugin.PluginManager.InitializePluginsAsync()+(?) => { } in C:/projects/flow-launcher/Flow.Launcher.Core/Plugin/PluginManager.cs:line 252

贡献者指南