Null reference exception when adding items to network list from client connected callback?

I am running into some issues with the player join callback and network list. This is the only thing that I am loading into the scene right now

using Unity.Netcode;

public class MyNetworkManager : NetworkManager
{

  private NetworkList<ulong> ids;

  private void Start() {
    ids = new NetworkList<ulong>();
    OnClientConnectedCallback += (ulong playerId) => {
      print(playerId);
      ids.Add(playerId); // this is where I get error
      print(ids.Count);
    };
    StartHost();
  }
}

The error that I get is

NullReferenceException: Object reference not set to an instance of an object
Unity.Netcode.NetworkList`1[T].Add (T item) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.5.1/Runtime/NetworkVariable/Collections/NetworkList.cs:377)
MyNetworkManager.<Start>b__1_0 (System.UInt64 playerId) (at Assets/Scripts/Managers/MyNetworkManager.cs:12)
Unity.Netcode.NetworkConnectionManager.InvokeOnClientConnectedCallback (System.UInt64 clientId) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.5.1/Runtime/Connection/NetworkConnectionManager.cs:46)

It’s longer but I don’t think anything below that is necessarily relevant. I think this has got to do with how the callback sets up the network list up to fail since everything runs fine if I just don’t add it id (or anything) to the network list.

To use NetworkList its containing class needs to derive from a NetworkBehaviour, the NetworkManager is actually a MonoBehaviour. Look into creating a separate class for your own additional network management, if you want access to the NetworkManager’s callbacks from there you can for example use NetworkManager.Singleton.OnClientConnectedCallback.