Open Sebbe opened 3 years ago
We are not able to reproduce in any of our test sites. Please send me the screenshot of enabled languages from your admin mode.
Hi, here is the languages we have enabled. This is also a multisite, not sure if that have anything to do though
@Sebbe would it be possible for you to run this code in any page controller?
var languageBranchRepository = ServiceLocator.Current.GetInstance<LanguageBranchRepository>();
var requestContext = ServiceLocator.Current.GetInstance<RequestContext>();
var languageSettingsHandler = ServiceLocator.Current.GetInstance<IContentLanguageSettingsHandler>();
IList<LanguageBranch> GetCurrentUserLanguages(ContentReference contentLink)
{
var localLanguageBranches = languageBranchRepository.ListEnabled();
return localLanguageBranches.Where(b =>
b.QueryEditAccessRights(requestContext.HttpContext.User) &&
languageSettingsHandler.IsLanguageAllowed(contentLink, b.LanguageID)).ToList();
}
object Format(LanguageBranch langBranch, LanguageBranch paramDefaultLanguageBranch)
{
var regionName = langBranch.Culture.IsNeutralCulture
? langBranch.Culture.Name
: new RegionInfo(langBranch.Culture.LCID).TwoLetterISORegionName;
return new
{
IsDefault = langBranch.LanguageID == paramDefaultLanguageBranch.LanguageID,
Country = regionName.ToUpper(),
Name = langBranch.LanguageID,
DisplayName = langBranch.Name
};
}
var languageBranches = GetCurrentUserLanguages(currentPage.ContentLink);
var branch = languageBranchRepository.Load(CultureInfo.CurrentUICulture);
var defaultLanguageBranch = branch ?? languageBranches.FirstOrDefault();
if (!languageBranches.Any())
{
var rootLanguages = GetCurrentUserLanguages(ContentReference.RootPage);
if (rootLanguages.Any())
{
languageBranches = rootLanguages;
}
else
{
// If languages are not set up for root we should fallback to all enabled ones
languageBranches = languageBranchRepository.ListEnabled();
}
}
foreach (var languageBranch in languageBranches)
{
var formatted = Format(languageBranch, defaultLanguageBranch);
}
For some reason, for one of your languages
var formatted = Format(languageBranch, defaultLanguageBranch);
will fail.
I tried to reproduce on our test sites but wasn't able to so I'd appreciate your help to identify the problematic language.
I wish I could say YES! it failed, but no. It works perfectly
I have used Jetbrainds dotpeak to make a symbol for the dll and gone through. It goes through twice (the format code) but it never fails there. it fails further down.
I wonder if it is something in our solution that we may have overwritten and that does so it fails? No idea what that can be though
Were you able to catch that exception? I mean with the generated pdbs, so we can be sure which exact line with what arguments fails?
@barteksekula I am facing a similar issue after installing Gridview 0.5.3. This is what I see:
[NullReferenceException: Object reference not set to an instance of an object.] EPiServer.Labs.GridView.DojoPathInitialization.ConfigureDojoPath(Object sender, EventArgs e) +82
@utopkar any stacktrace?
Hi, I just installed the content manager version 0.5.3 (didn't have any versions prior) I have not added anything in code, just installed the packages -> build -> visit website
When I go to the content manager, I get YSOD with a null reference error. The stacktrace:
[NullReferenceException: Objektreferanse er ikke satt til en objektforekomst.] EPiServer.Labs.ContentManager.AvailableLanguagesResolver.Format(LanguageBranch x, LanguageBranch defaultLanguageBranch) +192 System.Linq.WhereSelectListIterator
2.MoveNext() +116 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +276 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +1194 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +823 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +1194 Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +402 Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) +1129 EPiServer.Framework.Serialization.Json.Internal.JsonObjectSerializer.Serialize(TextWriter textWriter, Object value) +74 EPiServer.Labs.ContentManager.BootstrapViewModelExtensions.Serialize(Object val) +188 EPiServer.Labs.ContentManager.BootstrapViewModelExtensions.GetSerializedContentManagerSettings(BootstrapperViewModel viewModel) +873 ASP.cms_episerver_labs_content_manager_views_gridview_index_aspx.Rendercontrol4(HtmlTextWriter __w, Control parameterContainer) in \cms\episerver-labs-content-manager\Views\GridView\Index.aspx:102 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +117 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +132 ASP.cms_shell_views_shared_sleek_master.Rendercontrol1(HtmlTextWriter __w, Control parameterContainer) in \cms\Shell\Views\Shared\Sleek.Master:26 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +117 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +132 System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +271 System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer) +75 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +132 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +9490`