Skip to content

Commit

Permalink
fix rider warnings (#2994)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Dec 22, 2023
1 parent 725c830 commit e64acac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Sentry/Internal/DebugStackTrace.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,13 @@ private static void DemangleLambdaReturnType(SentryStackFrame frame)
[UnconditionalSuppressMessage("SingleFile", "IL3002:Avoid calling members marked with 'RequiresAssemblyFilesAttribute' when publishing as a single-file", Justification = AotHelper.SuppressionJustification)]
private static PEReader? TryReadAssemblyFromDisk(Module module, SentryOptions options, out string? assemblyName)
{
#pragma warning disable 0162 // Unreachable code on old .NET frameworks
if (AotHelper.IsNativeAot)
{
#pragma warning disable 0162 // Unreachable code on old .NET frameworks
assemblyName = null;
return null;
#pragma warning restore 0162
}
#pragma warning restore 0162

assemblyName = module.FullyQualifiedName;
if (options.AssemblyReader is { } reader)
Expand Down
13 changes: 9 additions & 4 deletions src/Sentry/Internal/StackFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,15 @@ public RealStackFrame(StackFrame frame)

public int GetILOffset() => _frame.GetILOffset();

[UnconditionalSuppressMessage("Trimming", "IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code", Justification = AotHelper.SuppressionJustification)]
public MethodBase? GetMethod() => AotHelper.IsNativeAot
? null
: _frame.GetMethod();
[UnconditionalSuppressMessage("Trimming",
"IL2026:Members annotated with 'RequiresUnreferencedCodeAttribute' require dynamic access otherwise can break functionality when trimming application code",
Justification = AotHelper.SuppressionJustification)]
public MethodBase? GetMethod()
{
#pragma warning disable 0162 // Unreachable code on old .NET frameworks
return AotHelper.IsNativeAot ? null : _frame.GetMethod();
#pragma warning restore 0162
}

#if NET5_0_OR_GREATER
public nint GetNativeImageBase() => _frame.GetNativeImageBase();
Expand Down

0 comments on commit e64acac

Please sign in to comment.