From ca6dc06a38e68d2d28046ce198735317911dae34 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Mon, 29 Sep 2025 14:02:49 -0500 Subject: [PATCH] Add suppression messages for assembly file path access When calling Assembly.GetFile, you get 2 trim warnings - IL3001 and IL3002. This was only suppressing one of these warnings. Adding the suppression for the other with the same justification. IL3002 is an extraneous suppression due to https://github.com/dotnet/runtime/issues/120475. --- .../Assemblies/Ecma/EcmaAssembly.ManifestResources.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.ManifestResources.cs b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.ManifestResources.cs index 1b37c0cc454aae..2595090b524a87 100644 --- a/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.ManifestResources.cs +++ b/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.ManifestResources.cs @@ -56,6 +56,8 @@ public sealed override string[] GetManifestResourceNames() return resourceNames; } + [UnconditionalSuppressMessage("SingleFile", "IL3001:Avoid accessing Assembly file path", + Justification = "ResourceLocation should never be ContainedInAnotherAssembly if embedded in a single-file")] [UnconditionalSuppressMessage("SingleFile", "IL3002:RequiresAssemblyFiles on Module.GetFile", Justification = "ResourceLocation should never be ContainedInAnotherAssembly if embedded in a single-file")] public sealed override Stream? GetManifestResourceStream(string name)