Dynamically create RadzenSelectBar with RenderTreeBuilder fails

Hi,
I'm trying to dynamically generate RadzenSelectBars via Renderfragments. This fails, unfortunately, with an error:

warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: Error: No element is currently associated with component 14
System.InvalidOperationException: Error: No element is currently associated with component 14
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents)
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'Gp5GP5pHjs8iB6J11Sn_6QzLdZ66ebdnimbuzKqq3aw'.
System.AggregateException: One or more errors occurred. (Error: No element is currently associated with component 14)
 ---> System.InvalidOperationException: Error: No element is currently associated with component 14
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.InvokeRenderCompletedCallsAfterUpdateDisplayTask(Task updateDisplayTask, Int32[] updatedComponents)
   --- End of inner exception stack trace ---

Here's the code for the builder:

        OpFragment = builder =>
        {
            base.BuildRenderTree(builder);
            builder.OpenComponent<RadzenSelectBar<int>>(0);
            builder.AddAttribute(1, "TValue", "int");
            builder.OpenElement(2, "Items");
            builder.OpenComponent<RadzenSelectBarItem<int>>(3);
            builder.AddAttribute(4, "Text", "blah");
            builder.AddAttribute(5, "Value", 1);
            builder.CloseComponent();
            builder.CloseElement();
            builder.CloseComponent();
        };

Here's a similar code that creates a Dropdown instead, which works fine:

         OpFragment = builder =>
        {
            base.BuildRenderTree(builder);
            //builder.OpenComponent(0, typeof(RadzenSelectBar<int>));
            builder.OpenComponent<RadzenDropDown<string>>(0);
            builder.AddAttribute(1, "TValue", "string");
            builder.AddAttribute(2, "Data", new string[]{"x","y" });
            builder.CloseComponent();
        };

This is server-side Blazor, btw.

Hi @flipswitchingmonkey,

The 'Items' property isn't element but a RenderFragment. Here is how the generated code for our demo looks like (taken from obj\Debug\netcoreapp3.1\Razor\Pages):

__builder2.AddAttribute(40, "Items", (Microsoft.AspNetCore.Components.RenderFragment)((__builder3) => {
   __Blazor.LatestBlazor.Pages.SelectBarPage.TypeInference.CreateRadzenSelectBarItem_3(__builder3, 42, 43, "Orders", 44,  2);
   __Blazor.LatestBlazor.Pages.SelectBarPage.TypeInference.CreateRadzenSelectBarItem_4(__builder3,  46, "Employees", 48, 2);
   __Blazor.LatestBlazor.Pages.SelectBarPage.TypeInference.CreateRadzenSelectBarItem_5(__builder3, 50, 51, "Customers", 52,  3);
  }));

CreateRadzenSelectBarItem is something like this:

public static void CreateRadzenSelectBarItem_0<TValue>(RenderTreeBuilder __builder, int seq, int __seq0, __arg0, int __seq1, TValue __arg1)
{
   __builder.OpenComponent<global::Radzen.Blazor.RadzenSelectBarItem<TValue>>(seq);
   __builder.AddAttribute(__seq0, "Text", __arg0);
   __builder.AddAttribute(__seq1, "Value", __arg1);
   __builder.CloseComponent();
}

P.S. When in doubt I always check the Blazor generated code.