Glass Mapper - "The given key was not present in dictionary" - sitecore

We're trying to configure Glass Mapper for our Sitecore 6.6 instance but came across this error when testing it out.
[KeyNotFoundException: The given key was not present in the
dictionary.]
System.Collections.Generic.Dictionary`2.get_Item(TKey key) +13763207
Glass.Mapper.AbstractService..ctor(String contextName) +99
Glass.Mapper.Sc.SitecoreService..ctor(Database database, String contextName) +55
Glass.Mapper.Sc.SitecoreContext..ctor() +98
[Sublayout].Page_Load(Object sender, EventArgs e) in [Sublayout].ascx.cs:18
System.Web.UI.Control.OnLoad(EventArgs e) +109
System.Web.UI.Control.LoadRecursive() +68
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Control.LoadRecursive() +165
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+4498
and the code calling this is
protected void Page_Load(object sender, EventArgs e)
{
var context = new SitecoreContext();
Model = context.GetCurrentItem<Article>();
}
Version 3.3.1.53 is installed (as we had issues with our version of Sitecore on 4.x versions)

This might happen when context hasn't been loaded properly.
Make sure you deployed all the config's that comes with Glass eg:
Website\App_Config\Include\Glass.Mapper.Sc.CastleWindsor.config
Also make sure you copied across all the .dll's that comes with Glass Installation.

Related

sitecore 8 - getting "Failed" JS dialog when clicking on treeview links

When I tried to click on the treeview links from "Insert Options" (and in other windows as well).
Please check this below link for the error screen shot.
Error on tree-view link click
The error log has the following details:
*
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.sitecore_shell_controls_treeviewex_treeviewex_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\252d77a1\7452ed5e\App_Web_0so42fby.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: System.ArgumentNullException
Message: Null ids are not allowed.
Parameter name: name
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName)
at Sitecore.Web.UI.HtmlControls.Data.DataViewFactory.GetDataView(String name, String parameters)
at Sitecore.Web.UI.WebControls.TreeviewEx.RenderChildren(HtmlTextWriter output, Item parent)
at Sitecore.Web.UI.WebControls.TreeviewEx.Render(HtmlTextWriter output)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
*
Kindly help me if anyone knows the reason for this issue? I tried with one solution found in one of the site (by "disable" the authentication in the IIS) but it did not work for me.
Thanks in advance for your help.
I stumbled upon your question since we have the same problem, and this article describes exactly what we did and what problem we ran into.
I don't know if you added a URL rewrite rule for SEO to always use lowercase URLs, but it seems that Sitecore isn't a fan. So you should exclude this rule for your CM environment (what we did) or specifically exclude Sitecore urls (what they describe in the article).

Kentico Facebook API OATH issue

Kentico V9.0.44 seems to be giving errors using the Facebook Login feature. We are using the Login As Facebook and Register as Facebook feature. The issue is happening on the site and also on the "Goat" demo ecommerce site from Kentico. Does anyone have suggestions?
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Exception type: System.Web.HttpUnhandledException Stack Trace: at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Message: (OAuthException - #12) (#12) bio field is deprecated for versions v2.8 and higher
Exception type: Facebook.FacebookOAuthException Stack Trace: at Facebook.FacebookClient.ProcessResponse(HttpHelper httpHelper, String responseString, Type resultType, Boolean containsEtag, IList`1 batchEtags) at Facebook.FacebookClient.Api(HttpMethod httpMethod, String path, Object parameters, Type resultType) at Facebook.FacebookClient.Get(String path, Object parameters, Type resultType) at CMS.MembershipProvider.Facebook.FacebookUserProvider.GetFacebookUser(String facebookUserId, String accessToken) at CMSWebParts_Membership_FacebookConnect_FacebookConnectLogon.MapFacebookUserProfile(FacebookUserProfileMappingTriggerEnum mappingTrigger, UserInfo user, String userProfileId, String facebookAccessToken) at CMSWebParts_Membership_FacebookConnect_FacebookConnectLogon.SignInUser(UserInfo ui, String facebookUserId, String facebookAccessToken, Boolean mapFacebookProfile) at CMSWebParts_Membership_FacebookConnect_FacebookConnectLogon.SetupControlForPublicUser() at CMS.PortalControls.CMSWebPartZone.OnContentLoaded() at CMS.PortalControls.CMSAbstractLayout.OnContentLoaded() at CMS.PortalControls.CMSAbstractLayout.LoadWebPartsContent(Boolean reloadData) at CMS.PortalControls.CMSAbstractLayout.LoadContent(PageInfo pageInfo, Boolean reloadData, Boolean allowOrphanedZones) at CMS.PortalControls.CMSPagePlaceholder.LoadContent(PageInfo pageInfo, Boolean reloadData) at CMS.PortalControls.CMSPagePlaceholder.LoadContent(PageInfo pageInfo, Boolean reloadData) at CMS.PortalControls.CMSPortalManager.LoadPage(Boolean reloadData) at CMS.PortalControls.CMSPortalManager.PageHelper_InitComplete(Object sender, EventArgs e) at CMS.Helpers.PageContext.CurrentPage_InitComplete(Object sender, EventArgs e) at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Web.UI.Page.OnInitComplete(EventArgs e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Facebook makes updates to their API all of the time. A similar issue here with a fix but you will have to go into the web part code to fix it.

Sitecore's "Links" button doesn't work because of a null-reference exception

I am trying to see a certain item's linked items. I am doing this on a client's content management server. When I click on Navigate -> Links, nothing happens. I get this error in the JavaScript console:
http://sitename.local/sitecore/shell/default.aspx?xmlcontrol=Gallery.Links&…de-DE&vs=1&db=master&sc_content=master&ShowEditor=1&Ribbon.RenderTabs=true
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Here's what I see in Sitecore logs:
38424 19:09:30 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
at Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Nested Exception
Exception: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: ownerItem
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
at Sitecore.Data.Fields.Field..ctor(ID fieldID, Item ownerItem)
at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.GetLinkTooltip(Item reference, ItemLink link)
at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.RenderReferences(StringBuilder result, List`1 references)
at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.OnLoad(EventArgs e)
It looks like the ownerItem argument is null when creating an item field.
This happens for several different items—e.g. templates and sublayouts.
What is causing this issue and how do I fix it?
This issue was registered as a bug in Sitecore and it was fixed in the Sitecore 8.1 update 2 as a part of the fixes merged from 7.2 update 6:
"Includes all relevant fixes from Sitecore 7.2 update-6"
https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/Sitecore%2081/Sitecore%20Experience%20Platform%2081%20Update2/Release%20Notes
"452241: Links dialog fails if cross-database links are present"
https://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%207/ReleaseNotes/ChangeLog.aspx
To fix the issue in Sitecore 8.1 update 1, please install the following patch:
Put the attached Sitecore.Support.452241.dll file into the bin folder of your solution.
Replace the following string in the Website\sitecore\shell\Applications\Content Manager\Galleries\Links\Gallery Links.xml dialog:
<CodeBeside Type="Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm,Sitecore.Client"/>
with the new one:
<CodeBeside Type="Sitecore.Support.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm,Sitecore.Support.452241"/>
Link of the file you can find it here: https://www.dropbox.com/s/l36zqhwjtahl4q2/Sitecore.Support.452241.dll?dl=0

Sitecore Backend Labels missing

I have a Sitecore 7.5 instance, where the backend is broken after installing some packages with content, layouts and templates from an old Sitecore 6.3 SIP 3.2 instance and the new built DLLs from the solution. I also merged the config files of both instances.
This is how the backend of the 7.5 instance looks now:
Any idea what causes this and how I can fix this?
Thanks in advance!
EDIT: Labels and Save issue fixed. Getting an error message on the website.
Frontend error message:
[InvalidOperationException: intranetContext]
Sitecore.Diagnostics.Assert.IsNotNull(Object value, String message) +55
Sitecore.Intranet.Utils.IntranetUtil.get_CurrentIntranetSite() +403
Sitecore.Intranet.Settings.IntranetSettings.get_SiteDatabase() +89
Sitecore.Intranet.Utils.IntranetLanguageResolver.get_LanguageList() +61
Sitecore.Intranet.Utils.IntranetLanguageResolver.get_FullLanguageList() +188
Sitecore.Intranet.Utils.IntranetLanguageResolver.GetLanguageList(Boolean isContentArea, Boolean isExclusiveQS) +149
Sitecore.Intranet.Utils.IntranetLanguageResolver.GetLanguage(Item item, Boolean isContentArea, Boolean isExclusiveQS) +74
Sitecore.Intranet.Utils.IntranetLanguageResolver.IsContentLanguageAccessible(Item item, Language& language) +135
Sitecore.Intranet.HtmlControls.LocalizedPlaceholder.EnterContentArea() +81
Sitecore.Intranet.HtmlControls.LocalizedPlaceholder.OnInit(EventArgs e) +46
System.Web.UI.Control.InitRecursive(Control namingContainer) +186
System.Web.UI.Control.InitRecursive(Control namingContainer) +291
System.Web.UI.Control.InitRecursive(Control namingContainer) +291
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2098

"Empty strings are not allowed" error when adding Sitecore placeholder

I get the following error message when trying to add a placeholder to a layout in Sitecore 6.5:
"Empty strings are not allowed.<br>Parameter name: xml"
Any idea what could be the problem? The following stack trace appears in the log:
1124 10:20:56 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.sitecore_shell_default_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\59ed33b7\d6112557\App_Web_edgk4py3.1.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Nested Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Sitecore.Reflection.ReflectionUtil.CallMethod(Type type, Object obj, String methodName, Boolean includeNonPublic, Boolean includeInherited, Object[] parameters)
at Sitecore.Reflection.ReflectionUtil.CallMethod(Object obj, String methodName, Boolean includeNonPublic, Boolean includeInherited, Object[] parameters)
at Sitecore.Web.UI.HtmlControls.Component.HandleMessage(Message message)
at Sitecore.Shell.Framework.Commands.ClientEventCommand.SendEventMessage()
at Sitecore.Shell.Framework.Commands.ClientEventCommand.Execute(CommandContext context)
at Sitecore.Web.UI.Sheer.ClientPage.RaiseEvent()
at Sitecore.Web.UI.Sheer.ClientPage.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Nested Exception
Exception: System.ArgumentException
Message: Empty strings are not allowed.
Parameter name: xml
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName)
at Sitecore.Layouts.LayoutDefinition.Parse(String xml)
at Sitecore.Shell.Applications.Layouts.DeviceEditor.DeviceEditorForm.OnOK(Object sender, EventArgs args)
I encountered this issue and found the source of the issue to be the settings InvalidItemNameChars and ItemNameValidation being blank in the web.config.
I have removed the values to import a packages with invalid characters as soon as I restored the values to the Default values, shown below, the exception stopped occurring.
<setting name="InvalidItemNameChars" value="\/:?"<>|[]" />
<setting name="ItemNameValidation" value="^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$" />
Most commonly, this has to do with your language settings. Like for instance; if your user (via the default Content Language) is set to edit items in a language, the current item you are editing does not have a language specific version for.
So for instance; you're on an item that exists in "en" - and the user you are logged in as; defaults to "da-DK" - AND the current item does not have a version in "da-DK".
I've not seen this bug in a long while though, I would have thought it fixed.
It might not be this issue at all, but it's really hard to tell from the limited information you have on the issue.
Take a look at your user settings; also if there's any "ContentLanguage" attributes defined in your site definition that might not be what you expect.