Reputation: 4100
I have deleted "Danish" language from sitecore. In my solution I am getting exception, where ever I have used the code Sitecore.Context.Language.Name
.
Here is the exception
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.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
The whole stack trace
Source Error:
Line 22: static Model.Localization.CommonDictionary GetCommonLocalizations()
Line 23: {
Line 24: return Dictionary[Sitecore.Context.Language.Name];
Line 25: }
Line 26: public static string DefaultActivityTitle { get { return GetCommonLocalizations().DefaultActivityTitle; } }
Source File: E:\IIS Data\MySite\Utilities\SF.ISK.Kernel\Localisation\CommonDictionary.cs Line: 24
Stack Trace:
[KeyNotFoundException: The given key was not present in the dictionary.]
System.Collections.Generic.Dictionary`2.get_Item(TKey key) +13763207
SF.ISK.Kernel.Localisation.CommonDictionary.GetCommonLocalizations() in E:\IIS Data\MySite\Utilities\SF.ISK.Kernel\Localisation\CommonDictionary.cs:24
SF.ISK.Kernel.Localisation.CommonDictionary.get_HtmlTitleTemplate() in E:\IIS Data\MySite\Utilities\SF.ISK.Kernel\Localisation\CommonDictionary.cs:136
SF.ISK.Website.layouts.ISK.ISKMainPageLayout.GetPageTitle() in E:\IIS Data\MySite\Website\layouts\ISK\ISK.MainPage.aspx.cs:51
SF.ISK.Website.layouts.ISK.ISKMainPageLayout.Page_Load(Object sender, EventArgs e) in E:\IIS Data\MySite\Website\layouts\ISK\ISK.MainPage.aspx.cs:41
System.Web.UI.Control.OnLoad(EventArgs e) +109
System.Web.UI.Control.LoadRecursive() +68
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4498
In above code if I replace it with return Dictionary["en"];
then I don't get the error.
Upvotes: 1
Views: 64
Reputation: 417
It is possible that your item has a version da-dk. Remove the da-dk version and publish.
It might be that while looking for da-dk which has been deleted, sitecore is unable to find this key.
Upvotes: 0