Skip to content

Commit

Permalink
Fixed warnings thrown when AOT enabled
Browse files Browse the repository at this point in the history
There are two warnings thrown when using TargetFramework Net8.0 and setting PublishAOT=true. This change should fix it for non-DEBUG builds. For debug builds you would not normally enable AOT.
  • Loading branch information
plyoung committed May 12, 2024
1 parent 116a3d8 commit 8e516d1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions addons/GDTask/Internal/DiagnosticsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -43,7 +44,8 @@ internal static class DiagnosticsExtensions
{ typeof(GDTaskVoid), "GDTaskVoid" }
};

public static string CleanupAsyncStackTrace(this StackTrace stackTrace)
[RequiresUnreferencedCode("Calls System.Diagnostics.StackFrame.GetMethod()")]
public static string CleanupAsyncStackTrace(this StackTrace stackTrace)
{
if (stackTrace == null) return "";

Expand Down Expand Up @@ -120,15 +122,15 @@ public static string CleanupAsyncStackTrace(this StackTrace stackTrace)
return sb.ToString();
}


static bool IsAsync(MethodBase methodInfo)
{
var declareType = methodInfo.DeclaringType;
return typeof(IAsyncStateMachine).IsAssignableFrom(declareType);
}

// code from Ben.Demystifier/EnhancedStackTrace.Frame.cs
static bool TryResolveStateMachineMethod(ref MethodBase method, out Type declaringType)
// code from Ben.Demystifier/EnhancedStackTrace.Frame.cs
[RequiresUnreferencedCode("Calls System.Type.GetMethods()")]
static bool TryResolveStateMachineMethod(ref MethodBase method, out Type declaringType)
{
declaringType = method.DeclaringType;

Expand Down

0 comments on commit 8e516d1

Please sign in to comment.