Skip to content

Commit db70025

Browse files
committed
Add trim annotations to 'TokenView'
1 parent d96cd92 commit db70025

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

components/TokenView/src/TokenView/TokenView.ItemsSource.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;
610

711
public partial class TokenView : ListViewBase
@@ -15,6 +19,9 @@ protected override void OnItemsChanged(object e)
1519
base.OnItemsChanged(e);
1620
}
1721

22+
#if NET8_0_OR_GREATER
23+
[RequiresUnreferencedCode("This method accesses the 'Remove' method of the assigned items source collection in a trim-unsafe way.")]
24+
#endif
1825
private void ItemsSource_PropertyChanged(DependencyObject sender, DependencyProperty dp)
1926
{
2027
// Use reflection to store a 'Remove' method of any possible collection in ItemsSource

components/TokenView/src/TokenView/TokenView.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;
610

711
/// <summary>
@@ -26,6 +30,9 @@ public partial class TokenView : ListViewBase
2630
/// <summary>
2731
/// Creates a new instance of the <see cref="TokenView"/> class.
2832
/// </summary>
33+
#if NET8_0_OR_GREATER
34+
[RequiresUnreferencedCode("This method accesses the 'Remove' method of the assigned items source collection in a trim-unsafe way.")]
35+
#endif
2936
public TokenView()
3037
{
3138
this.DefaultStyleKey = typeof(TokenView);

0 commit comments

Comments
 (0)