Closed tranpl closed 1 year ago
@leigh-pointer it looks like the recent fix to the LanguageSwitcher is not backward compatible:
Object reference not set to an instance of an object. Oqtane.Themes.Controls.LanguageSwitcher.OnParametersSet() in LanguageSwitcher.razor, line 32 MenuAlignment = DropdownAlignment.ToLower() == "right" ? "dropdown-menu-end" : string.Empty;
This is because DropdownAlignment is null - so the ToLower() will throw an exception
@sbwalker
Upgrading from 3.4.3 does not run into this issue. New installation of 4.0.5
LanguageSwitcher changes are not in release 4.0.5. It is an issue with the https://github.com/oqtane/oqtane.theme.bootswatch Theme
@leigh-pointer the error message in the original post clearly contains a reference to "MenuAlignment = DropdownAlignment.ToLower() == "right" ? "dropdown-menu-end" : string.Empty;" which only exists in the Dev branch. So the issue is not in the 4.0.5 release - it is in the Dev branch (which is still versioned 4.0.5).
Upgrading from 3.4.3 does not run into this issue. New installation of 4.0.5, downloaded the bootswatch collection in theme manager, set to Flatly theme, restart application. Getting error below:
An unhandled exception occurred while processing the request. NullReferenceException: Object reference not set to an instance of an object. Oqtane.Themes.Controls.LanguageSwitcher.OnParametersSet() in LanguageSwitcher.razor, line 32
Stack Query Cookies Headers Routing NullReferenceException: Object reference not set to an instance of an object. Oqtane.Themes.Controls.LanguageSwitcher.OnParametersSet() in LanguageSwitcher.razor + MenuAlignment = DropdownAlignment.ToLower() == "right" ? "dropdown-menu-end" : string.Empty; Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync() Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(ref DiffContext diffContext, int frameIndex) Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(ref DiffContext diffContext, int frameIndex) Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(ref DiffContext diffContext, int newFrameIndex) Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(ref DiffContext diffContext, int oldStartIndex, int oldEndIndexExcl, int newStartIndex, int newEndIndexExcl) Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, int componentId, ArrayRange oldTree, ArrayRange newTree)
Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, out Exception renderFragmentException)
Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToRenderQueue(int componentId, RenderFragment renderFragment)
Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
Oqtane.App.ChangeState(PageState pageState) in App.razor
+
StateHasChanged();
Oqtane.UI.SiteRouter.Refresh() in SiteRouter.razor
+
OnStateChange?.Invoke(_pagestate);
Oqtane.UI.SiteRouter.OnParametersSetAsync() in SiteRouter.razor
+
await Refresh();
Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Microsoft.AspNetCore.Components.RenderTree.Renderer.gProcessAsynchronousWork|48_0()
Microsoft.AspNetCore.Components.RenderTree.Renderer.WaitForQuiescence()
Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderRootComponentAsync(int componentId, ParameterView initialParameters)
Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.RenderComponentAsync(Type componentType, ParameterView initialParameters)
Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext+<>c11+<b 11_0>d.MoveNext()
Microsoft.AspNetCore.Mvc.ViewFeatures.StaticComponentRenderer.PrerenderComponentAsync(ParameterView parameters, HttpContext httpContext, Type componentType)
System.Threading.Tasks.ValueTask.get_Result()
Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.PrerenderedServerComponentAsync(HttpContext context, ServerComponentInvocationSequence invocationId, Type type, ParameterView parametersCollection)
Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.RenderComponentAsync(ViewContext viewContext, Type componentType, RenderMode renderMode, object parameters)
System.Threading.Tasks.ValueTask.get_Result()
Microsoft.AspNetCore.Mvc.TagHelpers.ComponentTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.g Awaited|0_0(Task task, TagHelperExecutionContext executionContext, int i, int count)
Oqtane.Pages.PagesHost.b 14_1() in _Host.cshtml
+
Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync() Oqtane.Pages.Pages__Host.ExecuteAsync() in _Host.cshtml +
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context) Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, bool invokeViewStarts) Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context) Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable