From 49dac1ca736932673d4fd3f0558b6534494fd599 Mon Sep 17 00:00:00 2001 From: Arlo Date: Tue, 17 Dec 2024 12:30:49 -0600 Subject: [PATCH] Only enable suppression message for trimming warning in GetContentControl method in .NET 8.0 or greater --- .../src/Tree/FrameworkElementExtensions.LogicalTree.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/Extensions/src/Tree/FrameworkElementExtensions.LogicalTree.cs b/components/Extensions/src/Tree/FrameworkElementExtensions.LogicalTree.cs index 75897ce0..2ffaba73 100644 --- a/components/Extensions/src/Tree/FrameworkElementExtensions.LogicalTree.cs +++ b/components/Extensions/src/Tree/FrameworkElementExtensions.LogicalTree.cs @@ -662,7 +662,9 @@ public static IEnumerable FindParents(this FrameworkElement el /// /// The parent element. /// The retrieved content control, or if not available. + #if NET8_0_OR_GREATER [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "This method is currently not safe for trimming, and annotations here wouldn't help.")] + #endif public static UIElement? GetContentControl(this FrameworkElement element) { Type type = element.GetType();