Skip to content

Commit a872a43

Browse files
authored
Merge pull request #310 from CommunityToolkit/dev/add-missing-trimming-annotations
Add missing trimming annotations
2 parents 41abf66 + 58aa6a7 commit a872a43

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CommunityToolkit.Common/Extensions/TaskExtensions.cs

Lines changed: 8 additions & 1 deletion
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 NET6_0_OR_GREATER
6+
using System.Diagnostics.CodeAnalysis;
7+
#endif
58
using System.Reflection;
69
using System.Runtime.CompilerServices;
710
using System.Threading.Tasks;
@@ -24,7 +27,11 @@ public static class TaskExtensions
2427
/// a value type, which adds overhead. It should only be used when using generics is not possible.
2528
/// </remarks>
2629
[MethodImpl(MethodImplOptions.AggressiveInlining)]
27-
public static object? GetResultOrDefault(this Task task)
30+
public static object? GetResultOrDefault(
31+
#if NET6_0_OR_GREATER
32+
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
33+
#endif
34+
this Task task)
2835
{
2936
// Check if the instance is a completed Task
3037
if (

CommunityToolkit.Mvvm/ComponentModel/ObservableValidator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@ private void ClearErrorsForProperty(string propertyName)
802802
/// </summary>
803803
/// <param name="propertyName">The target property name being validated.</param>
804804
/// <returns>The display name for the property.</returns>
805+
[RequiresUnreferencedCode("The type of the current instance cannot be statically discovered.")]
805806
private string GetDisplayNameForProperty(string propertyName)
806807
{
807808
static Dictionary<string, string> GetDisplayNames(Type type)

0 commit comments

Comments
 (0)