From fd7f81ac9c1fbf1ba0427f23fb0f2de3d9c5a028 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 25 Aug 2021 23:19:47 -0400 Subject: fix assembly resolver not tracking loaded mods correctly --- .../Framework/ModLoading/AssemblyDefinitionResolver.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs') diff --git a/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs b/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs index b3415609..8e2f5ef3 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs @@ -21,13 +21,13 @@ namespace StardewModdingAPI.Framework.ModLoading public void Add(params AssemblyDefinition[] assemblies) { foreach (AssemblyDefinition assembly in assemblies) - this.Add(assembly, assembly.Name.Name, assembly.Name.FullName); + this.AddWithExplicitNames(assembly, assembly.Name.Name, assembly.Name.FullName); } - /// Add known assemblies to the resolver. + /// Add a known assembly to the resolver with the given names. This overrides the assembly names that would normally be assigned. /// The assembly to add. /// The assembly names for which it should be returned. - public void Add(AssemblyDefinition assembly, params string[] names) + public void AddWithExplicitNames(AssemblyDefinition assembly, params string[] names) { this.RegisterAssembly(assembly); foreach (string name in names) @@ -36,12 +36,18 @@ namespace StardewModdingAPI.Framework.ModLoading /// Resolve an assembly reference. /// The assembly name. - public override AssemblyDefinition Resolve(AssemblyNameReference name) => this.ResolveName(name.Name) ?? base.Resolve(name); + public override AssemblyDefinition Resolve(AssemblyNameReference name) + { + return this.ResolveName(name.Name) ?? base.Resolve(name); + } /// Resolve an assembly reference. /// The assembly name. /// The assembly reader parameters. - public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) => this.ResolveName(name.Name) ?? base.Resolve(name, parameters); + public override AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters) + { + return this.ResolveName(name.Name) ?? base.Resolve(name, parameters); + } /********* -- cgit