private static bool TryGetEditorConfigOptionForMissingFiles(AnalyzerOptions analyzerOptions, Compilation compilation, out bool optionValue)
        {
            optionValue = false;
            try
            {
                var provider = analyzerOptions.GetType().GetRuntimeProperty("AnalyzerConfigOptionsProvider")?.GetValue(analyzerOptions);
                if (provider == null || !compilation.SyntaxTrees.Any())
                {
                    return(false);
                }

                var getOptionsMethod = provider.GetType().GetRuntimeMethods().FirstOrDefault(m => m.Name == "GetOptions");
                if (getOptionsMethod == null)
                {
                    return(false);
                }

                var options           = getOptionsMethod.Invoke(provider, new object[] { compilation.SyntaxTrees.First() });
                var tryGetValueMethod = options.GetType().GetRuntimeMethods().FirstOrDefault(m => m.Name == "TryGetValue");
                if (tryGetValueMethod == null)
                {
                    return(false);
                }

                // bool TryGetValue(string key, out string value);
                var parameters = new object?[] { BailOnMissingPublicApiFilesEditorConfigOptionName, null };
                if (!(tryGetValueMethod.Invoke(options, parameters) is bool hasOption) ||
                    !hasOption)
                {
                    return(false);
                }

                if (!(parameters[1] is string value) ||
                    !bool.TryParse(value, out var boolValue))
                {
                    return(false);
                }

                optionValue = boolValue;
                return(true);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch
#pragma warning restore CA1031 // Do not catch general exception types
            {
                // Gracefully handle any exception from reflection.
                return(false);
            }
        }