1
An item with the same key has already been added.
Problem reported by John Bouchard - 4/25/2023 at 9:07 AM
Resolved
I have a .NET MVC app that has been running version 6.5.2 of FileUltimate for the past couple of years with no issues. I recently updated Visual Studio, and ever since I have been getting the following error message whenever I try running it on localhost: 

[ArgumentException: An item with the same key has already been added.]
   System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +60
   System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +14413254
   GleamTech.Globalization.CultureManager._6f(AssemblyResourceStore assemblyResourceStore, BackSlashPath relativeCultureFilePathTemplate, Char cultureSeparatorChar, IDictionary`2 cultureMappings) +429
   GleamTech.FileUltimate.AspNet.FileUltimateWebConfiguration.RegisterLocalization() +813
   System.Action.Invoke() +0
   GleamTech.AspNet.GleamTechWebConfiguration.OnApplicationStarted() +76
   GleamTech.AspNet.NetFramework.WebActivationModule.Init(HttpApplication httpApplication) +115
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +584
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +168
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +277
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +369

[HttpException (0x80004005): An item with the same key has already been added.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +532
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +111
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +719

upon publishing the project to our development server, the site works as expected. The only method I have found to make it work on localhost is by removing the assembly reference to FileUltimate and commenting out the code that uses it. Below is a list of troubleshooting steps I tried that did not work on  localhost: 
  • Deleting Visual Studio temp files in C:\Users\[username]\AppData\Local. 
  • Deleting project files in the bin and obj folders. 
  • Uninstalling and reinstalling the FileUltimate, GleamTech.Core, ImageUltimate, VideoUltimate, and DocumentUltimate NuGet packages. 
  • Uninstalling (without reinstalling) the ImageUltimate, VideoUltimate and DocumentUltimate NuGet packages.
  • Uninstalling and reinstalling all NuGet packages in the project.
  • Deleting and redownloading the entire git repository for the project.
  • Fresh install of Visual Studio.
The application is targeting .NET Framework 4.6.1 and runs on IIS Express. 

4 Replies

Reply to Thread
0
Cem Alacayir Replied
Employee Post
FileUltimate v6.5.2 is an old version from April 4, 2019.

You need to update your version more regularly, the software can work for years but the surrounding environment changes, i.e. Operating System changes, .NET Framework changes. Which in your case, Microsoft seems to change some culture specific part in .NET Framework.

This was fixed (made compatible) back in GleamTech.Common.dll Version 4.3.0 - September 15, 2020 which corresponds to FileUltimate v7.7.0 so you need to use v7.7.0 or later version.
The same error was discussed here:
1
John Bouchard Replied
We purchased an updated license key. FileUltimate version 8.5.1 is installed and everything is now working as expected. 
0
Cem Alacayir Replied
Employee Post Marked As Resolution
That's great. We constantly improve the product for stability and performance. I guess you upgraded to v8.5.1 but not to the latest 8.8.5 due to min framework change from net461 to net472 after v8.6.0? 

For your reference (not urgent but just to let you know),
Microsoft ended support for .NET Framework versions 4.5.2, 4.6, and 4.6.1 on April 26, 2022, so security fixes, updates, and technical support for these versions will no longer be provided.  
0
John Bouchard Replied
Yes, that is the reason. We will definitely look into targeting a newer version of .NET. Thank you for your help!

Reply to Thread