diff --git a/src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/AssemblySymbolLoader.cs b/src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/AssemblySymbolLoader.cs index 1d6921dd1f92..f90efb19f4ad 100644 --- a/src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/AssemblySymbolLoader.cs +++ b/src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/AssemblySymbolLoader.cs @@ -16,6 +16,22 @@ namespace Microsoft.DotNet.ApiSymbolExtensions /// public class AssemblySymbolLoader : IAssemblySymbolLoader { + // This is a list of dangling .NET Framework internal assemblies that should never get loaded. + private static readonly HashSet s_assembliesToIgnore = [ + "System.ServiceModel.Internals", + "Microsoft.Internal.Tasks.Dataflow", + "MSDATASRC", + "ADODB", + "Microsoft.StdFormat", + "stdole", + "PresentationUI", + "Microsoft.VisualBasic.Activities.Compiler", + "SMDiagnostics", + "System.Xaml.Hosting", + "Microsoft.Transactions.Bridge", + "Microsoft.Workflow.Compiler" + ]; + private readonly ILog _log; // Dictionary that holds the paths to help loading dependencies. Keys will be assembly name and // value are the containing folder. @@ -339,13 +355,18 @@ private void ResolveReferences(PEReader peReader, ImmutableHashSet? refe foreach (AssemblyReferenceHandle handle in reader.AssemblyReferences) { AssemblyReference reference = reader.GetAssemblyReference(handle); - string name = $"{reader.GetString(reference.Name)}.dll"; + string nameWithoutExtension = reader.GetString(reference.Name); + + // Skip assemblies that should never get loaded because they are purely internal + if (s_assembliesToIgnore.Contains(nameWithoutExtension)) + continue; + + string name = nameWithoutExtension + ".dll"; // Skip reference assemblies that are loaded later. if (referenceAssemblyNamesToIgnore != null && referenceAssemblyNamesToIgnore.Contains(name)) continue; - // If the assembly reference is already loaded, don't do anything. if (_loadedAssemblies.ContainsKey(name)) continue;