Pathoschild / SMAPI

The modding API for Stardew Valley.
https://smapi.io/
GNU Lesser General Public License v3.0
1.82k stars 259 forks source link

Crash if content packs use different capitalisation for required mod ID #469

Closed Pathoschild closed 6 years ago

Pathoschild commented 6 years ago

If two content packs have the same ContentPackFor.UniqueID but different capitalisation (like Pathoschild.ContentPatcher and pathoschild.contentpatcher), SMAPI crashes with this error:

An error occured in the overridden update loop: System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at StardewModdingAPI.Program.LoadMods(IModMetadata[] mods, JsonHelper jsonHelper, ContentCore contentCore, ModDatabase modDatabase) in C:\source\_Stardew\SMAPI\src\SMAPI\Program.cs:line 737
at StardewModdingAPI.Program.InitialiseAfterGameStart() in C:\source\_Stardew\SMAPI\src\SMAPI\Program.cs:line 395
at StardewModdingAPI.Framework.SGame.Update(GameTime gameTime) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\SGame.cs:line 321
Pathoschild commented 6 years ago

Fixed in develop for the upcoming SMAPI 2.5.5.