Skip to content

Commit d1bce29

Browse files
committed
Workaround for ILLinker analyzer crash, fix trimming annotations
1 parent 3affd93 commit d1bce29

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

CommunityToolkit.Common/Extensions/TaskExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,10 @@ public static class TaskExtensions
2626
/// and uses reflection to access the <see cref="Task{TResult}.Result"/> property and boxes the result if it's
2727
/// a value type, which adds overhead. It should only be used when using generics is not possible.
2828
/// </remarks>
29-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
30-
public static object? GetResultOrDefault(
3129
#if NET6_0_OR_GREATER
32-
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
30+
[RequiresUnreferencedCode("This method uses reflection to try to access the Task<T>.Result property of the input Task instance.")]
3331
#endif
34-
this Task task)
32+
public static object? GetResultOrDefault(this Task task)
3533
{
3634
// Check if the instance is a completed Task
3735
if (

CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636

3737
<!-- Enable trimming support on .NET 6 -->
3838
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
39-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
39+
40+
<!-- Temporarily disabled as a workaround for https://github.com/dotnet/linker/issues/3032 -->
41+
<EnableTrimAnalyzer>false</EnableTrimAnalyzer>
4042
<IsTrimmable>true</IsTrimmable>
4143
</PropertyGroup>
4244

0 commit comments

Comments
 (0)