🐛 Bug Report
FluentLayout.NavigationDeferredLoading="true" + a SectionOutlet in the LayoutArea.Navigation item crashes with There is already a subscriber to the content with the given section ID when the window is resized across the 768px mobile breakpoint.
💻 Repro or Code Sample
MainLayout.razor (drop into any FluentUI v5 Blazor app — or simply add a SectionOutlet to the LayoutArea.Navigation item of the FluentUI demo's DemoMainLayout, which already uses NavigationDeferredLoading="true"):
@inherits LayoutComponentBase
<FluentLayout NavigationDeferredLoading="true">
<FluentLayoutItem Area="@LayoutArea.Header">
<FluentStack VerticalAlignment="VerticalAlignment.Center">
<FluentLayoutHamburger Display="@HamburgerDisplay.DesktopMobile" />
<SectionOutlet SectionName="topbar" />
</FluentStack>
</FluentLayoutItem>
<FluentLayoutItem Area="@LayoutArea.Navigation" Width="300px">
<SectionOutlet SectionName="sidebar" />
</FluentLayoutItem>
<FluentLayoutItem Area="@LayoutArea.Content">@Body</FluentLayoutItem>
</FluentLayout>
A page provides the content:
<SectionContent SectionName="sidebar">
<div>Some sidebar content</div>
</SectionContent>
Steps to reproduce:
- Run the app at a desktop window width (e.g. 1280px).
- Resize the window below the 768px mobile breakpoint — or back across it.
🤔 Expected Behavior
The layout adapts to the mobile viewport without error. The inline Navigation item and the hamburger drawer should render mutually exclusively across the breakpoint change.
😯 Current Behavior
Resizing throws an unhandled exception (crashes the app):
System.InvalidOperationException: There is already a subscriber to the content with the given section ID 'System.Object'.
at Microsoft.AspNetCore.Components.Sections.SectionRegistry.Subscribe(Object identifier, SectionOutlet subscriber)
at Microsoft.AspNetCore.Components.Sections.SectionOutlet.Microsoft.AspNetCore.Components.IComponent.SetParametersAsync(ParameterView parameters)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(...)
The section ID string shown depends on the identifier used — SectionName shows the name; a SectionId object shows its ToString().
💁 Possible Solution
FluentLayoutHamburger.NavigationContent defaults to the Navigation area's ChildContent:
NavigationContent => ChildContent ?? LayoutContainer?.Areas.Find(i => i.Area == LayoutArea.Navigation)?.ChildContent
On a breakpoint flip, FluentLayout.FluentLayout_MediaChangedAsync refreshes hamburgers before Navigation-area items, as two separate render batches:
foreach (var item in Hamburgers) await item.RefreshAsync();
foreach (var item in Areas.Where(i => i.Area == LayoutArea.Navigation)) await item.RefreshAsync();
With NavigationDeferredLoading="true", crossing the breakpoint flips RenderDrawer() (hamburger) and RenderThisArea() (nav item) in opposite directions. Because the hamburger renders first, the drawer's mirrored NavigationContent instantiates a second SectionOutlet with the same section ID while the nav item's outlet is still subscribed → SectionRegistry.Subscribe throws.
Suggested fix: refresh the Navigation-area items before the hamburgers in FluentLayout_MediaChangedAsync (so the old outlet unsubscribes before the drawer's mirror subscribes), or otherwise make the inline-nav / drawer-in-drawer rendering mutually exclusive within a single render batch. Happy to open a PR if the ordering approach is acceptable.
🔦 Context
Desktop tool whose page feeds a sidebar through SectionOutlet/SectionContent. The window is resizable; shrinking it across the 768px breakpoint (or back) crashes the whole app, making the layout unusable on smaller windows.
🌍 Your Environment
- OS & Device: Windows 11 on PC
- Browser: Edge WebView2 (Blazor WebView / Hybrid host)
- .NET and Fluent UI Blazor library Version: .NET 10.0, Microsoft.FluentUI.AspNetCore.Components 5.0.0-rc.4-26180.1
🐛 Bug Report
FluentLayout.NavigationDeferredLoading="true"+ aSectionOutletin theLayoutArea.Navigationitem crashes withThere is already a subscriber to the content with the given section IDwhen the window is resized across the 768px mobile breakpoint.💻 Repro or Code Sample
MainLayout.razor(drop into any FluentUI v5 Blazor app — or simply add aSectionOutletto theLayoutArea.Navigationitem of the FluentUI demo'sDemoMainLayout, which already usesNavigationDeferredLoading="true"):A page provides the content:
Steps to reproduce:
🤔 Expected Behavior
The layout adapts to the mobile viewport without error. The inline Navigation item and the hamburger drawer should render mutually exclusively across the breakpoint change.
😯 Current Behavior
Resizing throws an unhandled exception (crashes the app):
The section ID string shown depends on the identifier used —
SectionNameshows the name; aSectionIdobject shows itsToString().💁 Possible Solution
FluentLayoutHamburger.NavigationContentdefaults to the Navigation area'sChildContent:On a breakpoint flip,
FluentLayout.FluentLayout_MediaChangedAsyncrefreshes hamburgers before Navigation-area items, as two separate render batches:With
NavigationDeferredLoading="true", crossing the breakpoint flipsRenderDrawer()(hamburger) andRenderThisArea()(nav item) in opposite directions. Because the hamburger renders first, the drawer's mirroredNavigationContentinstantiates a secondSectionOutletwith the same section ID while the nav item's outlet is still subscribed →SectionRegistry.Subscribethrows.Suggested fix: refresh the Navigation-area items before the hamburgers in
FluentLayout_MediaChangedAsync(so the old outlet unsubscribes before the drawer's mirror subscribes), or otherwise make the inline-nav / drawer-in-drawer rendering mutually exclusive within a single render batch. Happy to open a PR if the ordering approach is acceptable.🔦 Context
Desktop tool whose page feeds a sidebar through
SectionOutlet/SectionContent. The window is resizable; shrinking it across the 768px breakpoint (or back) crashes the whole app, making the layout unusable on smaller windows.🌍 Your Environment