Why the attributes [InitializeOnLoad] and or [ExecuteInEditMode] are not working not fire ?

Using unity 2019.2.5f1 Personal

using System.Linq;
using UnityEditor;
using UnityEngine;

[InitializeOnLoad]
public class CustomHierarchy : MonoBehaviour
{
    private void Start()
    {
        GameObject[] allObjects = FindObjectsOfType<GameObject>();

        foreach (GameObject go in allObjects)
            if (go.activeInHierarchy)
            {
                print(go.name + " is active object");
            }
    }
}

I tried the ExecuteInEditMode and also the InitializeOnLoad but it’s not seems to make the code in Start
I tried also in Awake and Update but nothing.

I want it to work in the edit mode not run time.

Have you triggered the requirements for them to activate?