2016-10-19 2 views
1

Я удалил «датский» язык из sitecore. В моем решении я получаю исключение, где когда-либо использовал код Sitecore.Context.Language.Name.Sitecore 8: Удаление языка вызвало исключение KeyNotFoundException

Вот исключение

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. 

Всей трассировка стека

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 

В коде выше, если я заменю его return Dictionary["en"]; тогда я не получаю сообщение об ошибке.

+0

Можете ли вы опубликовать всю трассировку стека? –

+0

И каково значение 'Sitecore.Context.Language.Name'? Это 'da-DA'? Попробуйте отладить и посмотреть –

+0

Да, он все еще дает мне «da». – Kamran

ответ

0

Возможно, что ваш товар имеет версию da-dk. Удалите версию da-dk и опубликуйте.

Возможно, при поиске да-dk, который был удален, sitecore не может найти этот ключ.

Смежные вопросы