Templates missing, The given key was not present...

Jul 27, 2015 at 1:48 PM
I've created a few content types. I also have installed the demos (content and apps), but deleted a few. Now when I go to admin any view (Admin> Templates/Views) I get an error The given key was not present in the dictionary.

Latest 2sxc, latest DNN

I've cleared cache and restarted the app. What next? Full stack:
AbsoluteURL:/Default.aspx
DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke
ExceptionGUID:41debc45-e68f-479c-86d2-f0253d05d79e
AssemblyVersion:7.4.1
PortalId:0
UserId:1
TabId:93
RawUrl:/products?ctl=managetemplates&mid=490&AppId=5
Referrer:http://test.stage.test.com/products?ctl=eavmanagement&mid=490&AppId=5
UserAgent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36
ExceptionHash:s9Xojm/mWcCMu2xRWqiEFA==
Message:The given key was not present in the dictionary.
StackTrace:
InnerMessage:The given key was not present in the dictionary.
InnerStackTrace:
at System.Collections.Generic.Dictionary2.get_Item(TKey key)
at ToSic.Eav.Data.EntityRelationship.b__2(Nullable1 l)
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at ToSic.Eav.Data.EntityRelationship.GetEnumerator()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source)
at ToSic.SexyContent.Template.get_ContentDemoEntity()
at ToSic.SexyContent.ManageTemplates.b__6(<>f__AnonymousType222 <>h__TransparentIdentifier0, IContentType a)
at System.Linq.Enumerable.d__31`3.MoveNext()
at Telerik.Web.UI.GridResolveEnumerable.GetCollectionItemType(Boolean noItemsInEnumerator, Type& collectionItemType, Object& collectionFirstObject)
at Telerik.Web.UI.GridResolveEnumerable.ParseProperties()
at Telerik.Web.UI.GridResolveEnumerable.Initialize()
at Telerik.Web.UI.GridResolveEnumerable.EnsureInitialized()
at Telerik.Web.UI.GridEnumerableFromDataView..ctor(GridTableView owner, IEnumerable enumerable, Boolean CaseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText)
at Telerik.Web.UI.GridDataSourceHelper.CreateGridEnumerable(GridTableView owner, IEnumerable enumerable, Boolean caseSensitive, Boolean autoGenerateColumns, GridColumnCollection presentColumns, String[] additionalField, Boolean retrieveAllFields, Boolean enableSplitHeaderText)
at Telerik.Web.UI.GridTableView.get_ResolvedDataSource()
at Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource)
at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at Telerik.Web.UI.GridTableView.PerformSelect()
at Telerik.Web.UI.GridTableView.DataBind()
at ToSic.SexyContent.ManageTemplates.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Source:
FileName:
FileLineNumber:0
FileColumnNumber:0
Method:
Server Name: testserver
comments



I went to the database and looked at the table for ToSIC_SexyContent_Templates and the table is empty. I looked at another site that I had 2sxc and the table had entries for all the templates.
Aug 5, 2015 at 6:55 AM
Note that the ToSIC_...Templates is a old table which is not used any more. We don't remove it from the DB yet just in case something fails when migrating data away from that (going from v6 to v7) that it can still be fixed manually.

So #1: Ignore that table, it's not used.

Various people have had similar issues - usually when a content-type doesn't exist any more, which is used by a template. It's something we should fix someday. If this is the cause of your worries, check out https://github.com/2sic/2sxc/issues/292