diff --git a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs index 786fba131..07b86c7fa 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstallerWindow.cs @@ -1606,7 +1606,7 @@ namespace Dalamud.Interface.Internal.Windows if (!enableTask.Result) return; - var loadTask = Task.Run(() => plugin.Load(PluginLoadReason.Installer, plugin is LocalDevPlugin)) + var loadTask = Task.Run(() => plugin.Load(PluginLoadReason.Installer)) .ContinueWith(this.DisplayErrorContinuation, Locs.ErrorModal_LoadFail(plugin.Name)); loadTask.Wait(); diff --git a/Dalamud/Plugin/Internal/LocalPlugin.cs b/Dalamud/Plugin/Internal/LocalPlugin.cs index 58f845455..a1da03316 100644 --- a/Dalamud/Plugin/Internal/LocalPlugin.cs +++ b/Dalamud/Plugin/Internal/LocalPlugin.cs @@ -271,13 +271,23 @@ namespace Dalamud.Plugin.Internal { this.loader ??= PluginLoader.CreateFromAssemblyFile(this.DllFile.FullName, this.SetupLoaderConfig); - if (reloading) + if (reloading || this.IsDev) { - this.loader.Reload(); - - // Reload the manifest in-case there were changes here too. if (this.IsDev) { + // If a dev plugin is set to not autoload on boot, but we want to reload it at the arbitrary load + // time, we need to essentially "Unload" the plugin, but we can't call plugin.Unload because of the + // load state checks. Null any references to the assembly and types, then proceed with regular reload + // operations. + this.pluginAssembly = null; + this.pluginType = null; + } + + this.loader.Reload(); + + if (this.IsDev) + { + // Reload the manifest in-case there were changes here too. var manifestFile = LocalPluginManifest.GetManifestFile(this.DllFile); if (manifestFile.Exists) {