When handle method has parameters, Button.onClick.RemoveListener don't work

The Method someFunc has no parameter, RemoveListener work fine.
when the Method BackToStartView has a parameter, the RemoveListener don’t work, BackToStartView still called.

Sorry, my English is not good. Hope you can understand me.

public class UIManager : MonoBehaviour
{
    [SerializeField]
    private Button _backButton;

    private int _someNum = 101;

    void Start()
    {
        _backButton.onClick.AddListener(() => BackToStartView(_someNum));
        _backButton.onClick.RemoveListener(() => BackToStartView(_someNum));

        _backButton.onClick.AddListener(someFunc);
        _backButton.onClick.RemoveListener(someFunc);
    }

    private void someFunc()
    {
        Debug.Log("someFunc called");
    }

    private void BackToStartView(int passNum)
    {
        Debug.Log("passNum = " + passNum);
    }
}

Well you’re using anonymous functions/methods, in this case you’re having issues with the method not having the same pointer and so it is probably wonky, example of your anonymous functions:

     _backButton.onClick.AddListener(() => BackToStartView(_someNum));
     _backButton.onClick.RemoveListener(() => BackToStartView(_someNum));

I would assume that the anonymous function used in AddListener and RemoveListener do not have the same reference and are two separate anonymous functions built in IL and the reason why its not removed.

Try putting the anonymous function into an Action so the reference is consistent:

Action startView = () => { BackToStartView(_someNum); };

_backButton.onClick.AddListener(startView);
_backButton.onClick.RemoveListener(startView);

This is untested on my end, but the point is the method should have the same pointer, anonymous functions are on the fly and will not have the same reference in IL even though they are similar.

If a normal Action doesn’t work, try replacing with UnityAction as the delegate type.