Skip to content

Commit 0395f1b

Browse files
authored
Ignore internal .NET Framework assemblies in AssemblySymbolLoader
Resolves the false positive warnings in dotnet/aspnetcore#59853
1 parent 1875146 commit 0395f1b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/Compatibility/Microsoft.DotNet.ApiSymbolExtensions/AssemblySymbolLoader.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ namespace Microsoft.DotNet.ApiSymbolExtensions
1616
/// </summary>
1717
public class AssemblySymbolLoader : IAssemblySymbolLoader
1818
{
19+
// This is a list of dangling .NET Framework internal assemblies that should never get loaded.
20+
private static readonly HashSet<string> s_assembliesToIgnore = [
21+
"System.ServiceModel.Internals.dll",
22+
"Microsoft.Internal.Tasks.Dataflow.dll",
23+
"MSDATASRC.dll",
24+
"ADODB.dll",
25+
"Microsoft.StdFormat.dll",
26+
"stdole.dll",
27+
"PresentationUI.dll",
28+
"Microsoft.VisualBasic.Activities.Compiler.dll",
29+
"SMDiagnostics.dll",
30+
"System.Xaml.Hosting.dll",
31+
"Microsoft.Transactions.Bridge.dll",
32+
"Microsoft.Workflow.Compiler.dll"
33+
];
34+
1935
private readonly ILog _log;
2036
// Dictionary that holds the paths to help loading dependencies. Keys will be assembly name and
2137
// value are the containing folder.
@@ -341,11 +357,14 @@ private void ResolveReferences(PEReader peReader, ImmutableHashSet<string>? refe
341357
AssemblyReference reference = reader.GetAssemblyReference(handle);
342358
string name = $"{reader.GetString(reference.Name)}.dll";
343359

360+
// Skip assemblies that should never get loaded because they are purely internal
361+
if (s_assembliesToIgnore.Contains(name))
362+
continue;
363+
344364
// Skip reference assemblies that are loaded later.
345365
if (referenceAssemblyNamesToIgnore != null && referenceAssemblyNamesToIgnore.Contains(name))
346366
continue;
347367

348-
349368
// If the assembly reference is already loaded, don't do anything.
350369
if (_loadedAssemblies.ContainsKey(name))
351370
continue;

0 commit comments

Comments
 (0)