Generic Error when visiting Email related pages

Nick Peterson asked on February 16, 2023 21:45

I've recently inherited a Kentico CMS site running Kentico 10. I have no background with Kentico CMS so this may be a trivial issue. Our users noticed they were getting a generic error page when trying to edit an email template through the interface. When I was clicking around in the backend, I also noticed I'd encounter the same generic error when visiting "Email Queue" -> "Send Email".

The tail end of the exception looks like the following:


   ...
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at CMS.UIControls.CMSPage.Render(HtmlTextWriter writer)
   at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

   Message: An entry with the same key already exists.

   Exception type: System.ArgumentException
   Stack trace: 
   at System.Collections.Specialized.ListDictionary.Add(Object key, Object value)
   at System.Web.UI.ClientScriptManager.RegisterExpandoAttribute(String controlId, String attributeName, String attributeValue, Boolean encode)
   at System.Web.UI.ScriptRegistrationManager.RegisterExpandoAttribute(Control control, String controlId, String attributeName, String attributeValue, Boolean encode)

   EventUrl: /CMSModules/AdminControls/Pages/UIPage.aspx?elementguid=64da9a5b-7f26-4b49-8d40-3b67b90b0ad9&siteid=-4&objectid=766&displaytitle=false

I tried turning on debugging but the resulting logs didn't point to much. Any tips for obvious areas to look into?

Recent Answers


Juraj Ondrus answered on February 18, 2023 13:14

This looks like there is some issue in the DB. Maybe duplicate records? What is the history of the project? I know you said you have inherited the project but without knowing the history it is really hard to tell. Was the project upgraded from an older version? Did the issue started just recently? If yes, is it possible to get list of the most recent changes?
Right now I would recommend to do some tests by installing a fresh Kentico 10 instance, match the hotfix. Make sure the newly instance has the same hash salt string set as your current project.
And now, connect your project to the fresh DB by changing the connection string: are you able to reproduce the issue? If yes, then the issue is in the code, in the project and you need to compare your project files with the default project.
And/or connect the fresh Kentico project to your current DB: are you able to reproduce the issue? If yes, then the issue is in the DB. You can compare the DBs and also check the CMS_EmailTemplate (e.g. for any duplicates or weird records when compared to the fresh DB) and CMS_Class (look for cms.emailtemplate ClassName record and compare the ClassXMLSchema and ClassFormDefinition with the fresh instance)

0 votesVote for this answer Mark as a Correct answer

Nick Peterson answered on February 20, 2023 18:42

I believe this project had been upgraded a number of times over the years from Kentico 5/6? -> Kentico 10. I seem to recall it took quite a bit of effort to do some of the upgrades over the years but I'm not sure of the reasons. I ran a query that looked for duplicates across every table in our Kentico instance, and it didn't seem to turn up anything. I was using the fields ending in 'ID', not the guid fields if that would likely make a difference. A colleague of mine mentioned he has had some luck switching to IE legacy mode in Edge to get around some errors. Did Kentico 10 still have any requirements on old school IE to function correctly?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on February 21, 2023 05:32

I would recommend checking GUID and code name columns. The IDs will always be different as this is being ensured by SQL server and they are usually set to auto-increment. But maybe somehow a duplicate GUID or name record was entered.
Kentico 10 had no restrictions on the browsers and basically browsers at that time were supported - but that is a good question, maybe OLD Kentico does not work with NEWER browsers - so maybe time considering upgrading or maybe some refresh, redesign to get to a supported version. At least from a security reason - it is not a question whether but when the site will be hacked. And in the last months we have seen this as well.
Have you tried installing a fresh copy and connect the fresh project to your DB and/or your project to the fresh DB? What were the results?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.