ListView creating extra entry along with arraysize property warning

I’m trying to make a simple custom editor for a script that has nothing but a list of custom objects I’ve made in C#. I’ve named the list “MyCustomObjects”, and I’ve made a UIDocument for a custom control to represent a single instance of one of these objects. I want to populate one of these custom controls for each object in the list inside a ListView on my custom inspector UIDocument. This is how I’m doing it:

[CustomEditor(typeof(MySpecialClass))]
public class MySpecialClass_editor : Editor
{
    [SerializeField]
    public VisualTreeAsset MyEditorTree;

    [SerializeField]
    public VisualTreeAsset MyCustomObjectTree;

    public override VisualElement CreateInspectorGUI()
    {
        VisualElement myInspector = new VisualElement();
        MyEditorTree.CloneTree(myInspector);

        var listView = myInspector.Q<ListView>("MyCustomObjects");
        listView.Clear();
        listView.makeItem = MyCustomObjectTree.CloneTree;

        return myInspector;
    }
}

The issue is that it not only creates a custom control for all the items in the list, but it has an extra one at the beginning of the list, along with the following warning message in the console:
“Field type UnityEngine.UIElements.TemplateContainer is not compatible with ArraySize property “MyCustomObjects.Array.size”
UnityEditor.RetainedMode:UpdateSchedulers ()”

When I disable “Show Bound Collection Size”, it doesn’t insert an extra entry at the beginning, and the warning goes away, but I’m just curious what’s happening here? I feel like I’ve followed the example in the Unity documentation quite well. Unity - Manual: Bind to a list with ListView
Does the Unity documentation not do this if you follow it exactly??

The example in the documentation is using a header (show-foldout-header="true"). I assume you’re not if you’re getting this error. When we don’t use the header, an item count field is included in the list directly, and it doesn’t interact well if custom templates are used it seems. It could be a bug. You did the right thing by disabling the showBoundCollectionSize if you don’t need that extra item.

Thanks for the response. I would assume that this would indeed be a bug, but I’m not going to tell you guys how to do your job. That’s on you. At least there’s an easy workaround I guess.

…and also, of course I don’t need that extra item. Why in the world would someone want an extra repetition of a custom control for one of their list items?