Skip to content

Commit 5c0fb58

Browse files
committed
Fix some trim warnings
1 parent 9e161f1 commit 5c0fb58

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

components/CanvasView/src/CanvasView.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if NET8_0_OR_GREATER
6+
using System.Diagnostics.CodeAnalysis;
7+
#endif
58
using CommunityToolkit.Labs.WinUI.CanvasViewInternal;
69
using CommunityToolkit.WinUI.Helpers;
710

@@ -59,6 +62,9 @@ protected override void ClearContainerForItemOverride(DependencyObject element,
5962
}
6063
}
6164

65+
#if NET8_0_OR_GREATER
66+
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "These use of 'SetBindingExpressionValue' might be fine (we should revisit this later)")]
67+
#endif
6268
private void ContentPresenter_ManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
6369
{
6470
// Move the rectangle.

components/CanvasView/src/FrameworkElementExtensions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#if NET8_0_OR_GREATER
6+
using System.Diagnostics.CodeAnalysis;
7+
#endif
8+
59
namespace CommunityToolkit.Labs.WinUI.CanvasViewInternal;
610

711
public static partial class FrameworkElementExtensions
@@ -16,6 +20,9 @@ public static partial class FrameworkElementExtensions
1620
/// <param name="fe">The <see cref="FrameworkElement"/> with the property to update.</param>
1721
/// <param name="property">The <see cref="DependencyProperty"/> to update the underlying bound value of.</param>
1822
/// <param name="value">The new value to update the bound property to.</param>
23+
#if NET8_0_OR_GREATER
24+
[RequiresUnreferencedCode("This method accesses properties of binding expressions in a trim-unsafe way.")]
25+
#endif
1926
public static void SetBindingExpressionValue(this FrameworkElement fe, DependencyProperty property, object value)
2027
{
2128
var subBinding = fe.GetBindingExpression(property);

0 commit comments

Comments
 (0)