private bool IsEventHandler(UnityApi unityApi, [CanBeNull] IMethod method)
        {
            if (method == null)
            {
                return(false);
            }

            var type = method.GetContainingType();

            if (!unityApi.IsUnityType(type))
            {
                return(false);
            }

            var solution = method.GetSolution();
            var assetSerializationMode = solution.GetComponent <AssetSerializationMode>();
            var yamlParsingEnabled     = solution.GetComponent <AssetIndexingSupport>().IsEnabled;

            // TODO: These two are usually used together. Consider combining in some way
            if (!yamlParsingEnabled.Value || !assetSerializationMode.IsForceText || !solution.GetComponent <DeferredCacheController>().CompletedOnce.Value)
            {
                return(unityApi.IsPotentialEventHandler(method, false)); // if yaml parsing is disabled, we will consider private methods as unused
            }
            var eventsCount = solution
                              .GetComponent <UnityEventsElementContainer>()
                              .GetAssetUsagesCount(method, out bool estimatedResult);

            return(eventsCount > 0 || estimatedResult);
        }
        private bool IsEventHandler(UnityApi unityApi, [CanBeNull] IMethod method)
        {
            if (method == null)
            {
                return(false);
            }

            var type = method.GetContainingType();

            if (!unityApi.IsUnityType(type))
            {
                return(false);
            }

            var solution = method.GetSolution();
            var assetSerializationMode = solution.GetComponent <AssetSerializationMode>();
            var yamlParsingEnabled     = solution.GetComponent <UnityYamlSupport>().IsUnityYamlParsingEnabled;

            // TODO: These two are usually used together. Consider combining in some way
            if (!yamlParsingEnabled.Value || !assetSerializationMode.IsForceText)
            {
                return(unityApi.IsPotentialEventHandler(method, false)); // if yaml parsing is disabled, we will consider private methods as unused
            }
            return(method.GetSolution().GetComponent <UnitySceneDataLocalCache>().IsEventHandler(method));
        }