I have a DNN 9.9.1 in which there are two portals. One portal is working fine. For the second portal, going to edit mode results in this:
Server Error in '/' Application.
An entry with the same key already exists. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: An entry with the same key already exists.
Source Error:
[No relevant source lines]
Source File: c:\inetpub\vhosts\dev.hsc.com\tmp\root\d204065e\85bd8cfe\App_Web_vlvcbqh0.2.cs Line: 0
Stack Trace:
[ArgumentException: An entry with the same key already exists.] System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52 System.Collections.Generic.SortedList`2.Add(TKey key, TValue value) +6893600 DotNetNuke.Entities.Modules.DesktopModuleController.GetPortalDesktopModules(Int32 portalId) +196 DotNetNuke.Web.Components.Controllers.ControlBarController.GetCategoryDesktopModules(Int32 portalId, String category, String searchTerm) +177 Dnn.EditBar.UI.Items.AddModuleMenu.Visible() +80 Dnn.EditBar.UI.Controllers.<>c.b__4_0(BaseMenuItem m) +12 System.Linq.WhereListIterator`1.MoveNext() +73 System.Linq.Buffer`1..ctor(IEnumerable`1 source) +192 System.Linq.d__1.MoveNext() +175 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +387 System.Linq.Enumerable.ToList(IEnumerable`1 source) +58 Dnn.EditBar.UI.Controllers.EditBarController.GetMenuItems() +500 Dnn.EditBar.UI.Controllers.ContentEditorManager.OnInit(EventArgs e) +257 System.Web.UI.Control.InitRecursive(Control namingContainer) +139 System.Web.UI.Control.AddedControl(Control control, Int32 index) +185 System.Web.UI.ControlCollection.Add(Control child) +86 Dnn.EditBar.UI.HttpModules.EditBarModule.OnSkinInit(Object sender, SkinEventArgs e) +327 DotNetNuke.UI.Skins.Skin.InvokeSkinEvents(SkinEventType skinEventType) +285 DotNetNuke.UI.Skins.Skin.OnInit(EventArgs e) +512 System.Web.UI.Control.InitRecursive(Control namingContainer) +139 System.Web.UI.Control.AddedControl(Control control, Int32 index) +185 System.Web.UI.ControlCollection.Add(Control child) +86 DotNetNuke.Framework.DefaultPage.OnInit(EventArgs e) +1584 System.Web.UI.Control.InitRecursive(Control namingContainer) +139 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +408
[PageLoadException: An entry with the same key already exists.] DotNetNuke.Services.Exceptions.Exceptions.ProcessPageLoadException(Exception exc, String URL) +468 DotNetNuke.Framework.PageBase.OnError(EventArgs e) +743 System.Web.UI.Page.HandleError(Exception e) +84 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6560 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +245 System.Web.UI.Page.ProcessRequest() +72 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +22 System.Web.UI.Page.ProcessRequest(HttpContext context) +58 ASP.default_aspx.ProcessRequest(HttpContext context) in c:\inetpub\vhosts\dev.hsc.com\tmp\root\d204065e\85bd8cfe\App_Web_vlvcbqh0.2.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +188 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +48 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +71
---------------------------
I can clear the error by opening the browser's developer tools, go to Storage and remove LastPageId. Then I can get back to the page, but I'm not in Edit mode. If I create a third portal with the Blank template, the same error occurs. I cannot get into Edit mode. I'm looking for suggestgions to fix this ...
Posted By kietngo10 on 8/19/2024 10:43 AM How did you track down the orphan items in DesktopModules?
This process can be time-consuming, and often benefits those who have done a lot of challenging upgrades.
Doing this, specifically, can be somewhat straightforward. When a module is uninstalled and deleted, there should no longer be any related DLL in the <code>Bin</code> folder, and no related folder in the <code>DesktopModules</code> folder. Generally, when I uninstall an extension, I immediately check both places to see if they left any orphaned folders/files.
That is usually all you have to do, except in the more extreme scenarios when a module might not have been built or uninstalled correctly.
Posted By kietngo10 on 8/21/2024 6:18 AM Thanks for the info Will. I have a few modules I've tried to uninstall via DNN that still show up on my list of Modules so I'm going to manually remove them. I found your article https://willstrohl.com/Bl...-a-dotnetnuke-module and will follow those steps. I guess my initial question is what needs to be removed from the DesktopModules and ModuleDefinitions database tables that are causing this error when trying to edit any page? My sql queries below don't show any records for duplicate friendly names. SELECT friendlyname, COUNT(*) FROM ModuleDefinitions GROUP BY FriendlyName HAVING COUNT(*) > 1 SELECT DefinitionName, COUNT(*) FROM ModuleDefinitions GROUP BY DefinitionName HAVING COUNT(*) > 1 Thanks!
Well, that question is one that I'd be a bit afraid to try to answer. Every site gets implemented in a somewhat unique way. It really depends. You have eyes on the instance, and should be able to compare files and DB entries to map things together to figure out what data needs to be updated.
Great advice Will! Thanks for the recommendation. I wrote this down already in my "to do's..." when uinstalling a module.
These Forums are for the discussion of the open source CMS DNN platform and ecosystem.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.