SectionContent - IDE Rendering Fails


I'm using a sectionoutlet tag in my MainLayout, and then sectioncontent tags in various pages, the idea being to show a different image on each page in the header area.

In the IDE editor, if I open one page, this renders ok, but if I then open another, it won't render, and I get a error about there already being a subscription.

All works ok at runtime, but it's annoying when working in the IDE. Is this a bug? Or, if not, is there a way around it? Should I be using a different approach, perhaps?


Hi @SolutionJ,

I am afraid the provided information is insufficient to answer your question. Please provide additional details such as steps to reproduce the problem locally.

Sorry, of course.

In MainLayout.razor ...

          <SectionOutlet SectionId="qrcode" />                
                    <RadzenImage Path="qrimage" Style="width: 83px; height: 82px"></RadzenImage>

In any other page that uses Mainlayout...

<SectionContent SectionId="MainLayout.qrcode">
    <RadzenImage Path="images\qr-code.png" Style="width: 50px; height: 50px; float: right"></RadzenImage>

Put the above into any two pages, then in the IDE, open one page, in design mode, it should render ok. Open the second page, in design mode, it will produce error as below

System.InvalidOperationException: There is already a subscriber to the content with the given section ID 'Microsoft.AspNetCore.Components.Sections.SectionOutlet'.
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(ParameterView directAndCascadingParameters)
--- End of stack trace from previous location ---
at Radzen.Server.RemoteRenderer.HandleException(Exception exception)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
--- End of stack trace from previous location ---
at Radzen.Server.RemoteRenderer.HandleException(Exception exception)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
at Microsoft.AspNetCore.Components.RenderHandle.Render(RenderFragment renderFragment)
at Radzen.Server.Router.Render(Type layout, Type component, Boolean renderLayout)
at Radzen.Server.Router.OnRouteChanged(Object sender, RouteChangedEventArgs e)
at Radzen.Server.RouterService.Route(Type component, Type defaultLayout, Boolean renderLayout)
at Radzen.Server.CircuitHost.AddComponent(Type layout, Type page, Boolean renderLayout)
at Radzen.Server.ProjectServer.Render(String fileName, String source, Boolean renderLayout)
at Radzen.Server.ProgramController.Render(RenderRequest request)

Hi @SolutionJ,

We will investigate if this is possible to address. Meanwhile you can use the preprocessor to hide this code from design time.

Ok, many thanks korchev.

In case it helps, korchev, I only had to "wrap" the SectionOutlet tag in mainlayout in order to suppress the issue.

This chunk of code...

               @{ #if !RADZEN }
                    <SectionOutlet SectionId="MainLayout.qrcode" />
                @{ #endif }
                <RadzenImage Path="images\logo.png" Style="width: 83px; height: 82px"></RadzenImage>

@code {
    #nullable enable

    private ErrorBoundary? _errorBoundary;

    internal static object qrcode = new();

    protected override void OnParametersSet()


Hi @SolutionJ,

I am currently testing a fix. If successful it should go live with the next release.

1 Like