How to remove a custom list

I have a object pool that I want to dynamically grow and shrink.

/// <summary>
    /// Will remove inactive gameobjects. This method is called every 10-20 seconds.
    /// </summary>
    /// <param name="name">Type "ListOfObjects.Name." to find the object you want.</param>
    public void DecreasePool(ListOfObjects.Name name)
    {


        foreach (var item in AvailableObjectPool)
        {
            if (item.ObjectName == name && item.Objectpool.activeInHierarchy != true)
            {
              
                Destroy(item.Objectpool);
                break;
            }
        }


        AvailableObjectPool.RemoveAll(item => item.Objectpool == null);
    }


I have tried searching for answers for these errors but I still don’t understand what “supported pptr” means or why “ObjectDisposed” is thrown since all other methods check for a null object.

Note that these are errors thrown by the editor (not the engine) and its complaining about not being able to get the objects id and serializing something. I would guess that its it trying to serialize the value that you destroyed, but its destroyed so it cant. Im just guessing here, but see if circumventing that by removing the element from the list before destroying its field helps. something like this.

    public void DecreasePool(ListOfObjects.Name name)
    {
        var badItem = null;
        foreach (var item in AvailableObjectPool)
        {
            if (item.ObjectName == name && item.Objectpool.activeInHierarchy != true)
            {
                badItem = item;      
                break;
            }
        }
        if(badItem != null){
            AvailableObjectPool.Remove(badItem);
            Destroy(badItem.Objectpool);
        }
    }