Adding events with Reflection creates a nullpointer event call (For Button at least)

I am attempting to add events based on what’s read from XML, so I need reflection to access the event, the object calling the method, and the method to be called when the event fires. The actual content of the AddListener is commented above for reference of what I intend to do after this is solved. But the current code causes a null pointer at the Button.cs line 66. Normally when this appears, it further points up somewhere else that’s where the null pointer happened, but not this time. For some reason, the stack trace ends at Button.cs line 66.
And I don’t have the source the check what’s happening

This is the code that causes this:

UnityEngine.Events.UnityEvent ev = ((UnityEngine.Events.UnityEvent)member.GetMemberValue(target));
ev.AddListener(() => { });

The error:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:66)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:108)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update()

Have you check if
(UnityEngine.Events.UnityEvent)member is null
or
target is null?

Neither, the null pointer happens when you click the button, not when you set the event.
Yes, the empty event is causing a null pointer.

After checking decompiled code, it seems that the UnityEvent itself is null, so when it attempts to call Invoke() it crashes.
That’s the most perplexing thing about it, it’s not null when I am setting the listener, but it’s null when the button attempts to call it.

If I never attempt to add a listener to the event, then it’s not null

GetMemberValue returns UnityEngine.Events.UnityEvent?
Maybe is about casting

(UnityEngine.Events.UnityEvent)member.GetMemberValue(target);

I’ve attempted casting it to ButtonClickedEvent, which happens to be the exact type of the event I was setting.
The issue is that it’s null when you click the button, but not null when you set the listener
Even worse, it’s not null when you click the button if you happen to not set the listener. Makes absolutely no sense