mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Fail gracefully for IDalamudPlugin check failures
This commit is contained in:
parent
ca39735022
commit
5303a93a3d
1 changed files with 13 additions and 7 deletions
|
|
@ -55,13 +55,6 @@ namespace Dalamud.Plugin.Internal
|
|||
{
|
||||
// BadImageFormatException
|
||||
this.pluginAssembly = this.loader.LoadDefaultAssembly();
|
||||
|
||||
// InvalidOperationException
|
||||
this.pluginType = this.pluginAssembly.GetTypes().FirstOrDefault(type => type.IsAssignableTo(typeof(IDalamudPlugin)));
|
||||
if (this.pluginType == default)
|
||||
throw new Exception("Nothing inherits from IDalamudPlugin");
|
||||
|
||||
assemblyVersion = this.pluginAssembly.GetName().Version;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -73,6 +66,19 @@ namespace Dalamud.Plugin.Internal
|
|||
throw new InvalidPluginException(this.DllFile);
|
||||
}
|
||||
|
||||
this.pluginType = this.pluginAssembly.GetTypes().FirstOrDefault(type => type.IsAssignableTo(typeof(IDalamudPlugin)));
|
||||
if (this.pluginType == default)
|
||||
{
|
||||
this.pluginAssembly = null;
|
||||
this.pluginType = null;
|
||||
this.loader.Dispose();
|
||||
|
||||
Log.Error($"Nothing inherits from IDalamudPlugin: {this.DllFile.Name}");
|
||||
throw new InvalidPluginException(this.DllFile);
|
||||
}
|
||||
|
||||
assemblyVersion = this.pluginAssembly.GetName().Version;
|
||||
|
||||
// Files that may or may not exist
|
||||
this.manifestFile = LocalPluginManifest.GetManifestFile(this.DllFile);
|
||||
this.disabledFile = LocalPluginManifest.GetDisabledFile(this.DllFile);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue