Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash due to "Item with the same key" error for BSA files on load #28

Closed
focustense opened this issue Jul 17, 2021 · 1 comment
Closed
Labels
bug Something isn't working easynpc Issues/requests relating the EasyNPC app

Comments

@focustense
Copy link
Owner

Copied from the Nexus comments:

System.AggregateException: One or more errors occurred. (An item with the same key has already been added. Key: FortDawnguardImmersive - Textures.bsa)
 ---> System.ArgumentException: An item with the same key has already been added. Key: FortDawnguardImmersive - Textures.bsa
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Focus.Apps.EasyNpc.GameData.Files.ModPluginMap.<>c__DisplayClass3_0.<ForDirectory>b__4()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__277_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.WaitAllCore(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
   at System.Threading.Tasks.Parallel.Invoke(ParallelOptions parallelOptions, Action[] actions)
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException)
   at System.Threading.Tasks.Parallel.Invoke(ParallelOptions parallelOptions, Action[] actions)
   at System.Threading.Tasks.Parallel.Invoke(Action[] actions)
   at Focus.Apps.EasyNpc.GameData.Files.ModPluginMap.ForDirectory(String modRootDirectory, IModResolver modResolver, IEnumerable`1 pluginNames, IEnumerable`1 archiveNames)
   at Focus.Apps.EasyNpc.Mutagen.MutagenModPluginMapFactory.CreateForDirectory(String modRootDirectory)
   at Focus.Apps.EasyNpc.GameData.Files.ModPluginMapFactoryExtensions.DefaultMap(IModPluginMapFactory modPluginMapFactory)
   at Focus.Apps.EasyNpc.Profile.NpcConfiguration`1.SetFacePlugin(NpcOverrideConfiguration`1 faceConfig, Boolean detectFaceMod)
   at Focus.Apps.EasyNpc.Profile.NpcConfiguration`1.SetFacePlugin(String pluginName, Boolean detectFaceMod)
   at Focus.Apps.EasyNpc.Profile.NpcConfiguration`1.Reset(Boolean defaults, Boolean faces)
   at Focus.Apps.EasyNpc.Profile.NpcConfiguration`1..ctor(INpc`1 npc, IModPluginMapFactory modPluginMapFactory, IProfileRuleSet ruleSet)
   at Focus.Apps.EasyNpc.Profile.ProfileViewModel`1..ctor(IEnumerable`1 npcs, IModPluginMapFactory modPluginMapFactory, IEnumerable`1 loadedPluginNames, IEnumerable`1 masterNames, ProfileEventLog profileEventLog)
   at Focus.Apps.EasyNpc.Main.MainViewModel`1.<>c__DisplayClass55_0.<.ctor>b__1()
   at Focus.Apps.EasyNpc.Main.LoaderViewModel`1.ConfirmPlugins()
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__140_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at Focus.Apps.EasyNpc.App.Main()
@focustense
Copy link
Owner Author

I'm making an educated guess that this is due to the .GroupBy not using a string comparer, while .ToDictionary does use a string comparer - so, possibly, two mods containing the same archive with different letter case are being received into two different groups. Simple fix is to update the .GroupBy clauses (if the diagnosis is correct).

@focustense focustense added bug Something isn't working easynpc Issues/requests relating the EasyNPC app labels Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easynpc Issues/requests relating the EasyNPC app
Projects
None yet
Development

No branches or pull requests

1 participant