DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Portal Error Going to Edit Mode

 6 Replies
 3 Subscribed to this topic
 40 Subscribed to this forum
Sort:
Author
Messages
Veteran Member
Posts: 1246
Veteran Member
MVP
MVP
You're an MVP!

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 ...

Veteran Member
Posts: 1246
Veteran Member
MVP
MVP
You're an MVP!
duplicate DesktopModuleIDs in PortalDesktopModules referring to orphan entry in DesktopModules.

Actually there were two orphan items in DesktopModules that referred to two different versions of a module what was removed more than 10 years ago! Something didn't uninstall very well ...

Problem solved. Thanks to Sebastian Leupold for help.
New Around Here
Posts: 10
New Around Here
Hi Joe,
I just recently upgraded to 9.13.0 and am encountering the same issue. What was your resolution? Deleting the records in the database? How did you track down the orphan items in DesktopModules?
Thanks,
Kiet
Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
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.  

 

New Around Here
Posts: 10
New Around Here
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!
Senior Member
Posts: 1607
Senior Member
MVP
MVP
You're an MVP!
New Poster
New Poster
Congrats on posting!
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.  

 

Veteran Member
Posts: 363
Veteran Member
4 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!
4 Engaged Reader
Engaged Reader
You are an engaged reader!
2 Avid Reader
Avid Reader
Avid Reader art thou!
2 Most Liked
Most Liked
Congrats, your posts are really liked!

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:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved