Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rider warnings #2994

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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