private bool IsGetAsyncToolWindowFactoryOverridden()

in src/Microsoft.VisualStudio.SDK.Analyzers/VSSDK003SupportAsyncToolWindowAnalyzer.cs [124:142]


        private bool IsGetAsyncToolWindowFactoryOverridden(ITypeSymbol? packageTypeSymbol, INamedTypeSymbol asyncPackageType)
        {
            // Step up through the type hierarchy of the package class until we reach
            // the `AsyncPackage` type. Once we reach the `AsyncPackage` type, then the
            // `GetAsyncToolWindowFactory` method cannot be overridden.
            while (!SymbolEqualityComparer.Default.Equals(packageTypeSymbol?.OriginalDefinition, asyncPackageType))
            {
                IMethodSymbol? getAsyncToolWindowFactoryMethod = packageTypeSymbol?.GetMembers(Types.AsyncPackage.GetAsyncToolWindowFactory).OfType<IMethodSymbol>().FirstOrDefault();

                if (getAsyncToolWindowFactoryMethod != null && getAsyncToolWindowFactoryMethod.IsOverride)
                {
                    return true;
                }

                packageTypeSymbol = packageTypeSymbol?.BaseType;
            }

            return false;
        }