From 0dddcc54bc875a90f1ac5f145b7cfdfea81db591 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Fri, 14 Jun 2024 16:12:31 +0900 Subject: [PATCH] Point to DMI.Create from RUC message on StackFrame.GetMethod (#103400) Should help discoverability. --- .../src/System/Diagnostics/StackFrame.NativeAot.cs | 2 +- .../ref/System.Diagnostics.StackTrace.cs | 2 +- .../System.Private.CoreLib/src/System/Diagnostics/StackFrame.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.NativeAot.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.NativeAot.cs index ed17c7eb72d9a..f4b862c171778 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.NativeAot.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Diagnostics/StackFrame.NativeAot.cs @@ -39,7 +39,7 @@ public partial class StackFrame /// /// Returns the method the frame is executing /// - [RequiresUnreferencedCode("Metadata for the method might be incomplete or removed")] + [RequiresUnreferencedCode("Metadata for the method might be incomplete or removed. Consider using " + nameof(DiagnosticMethodInfo) + "." + nameof(DiagnosticMethodInfo.Create) + " instead")] public virtual MethodBase? GetMethod() { TryInitializeMethodBase(); diff --git a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs index c46c202e7ae14..8c7d12185b820 100644 --- a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs +++ b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs @@ -181,7 +181,7 @@ public StackFrame(string? fileName, int lineNumber, int colNumber) { } public virtual int GetFileLineNumber() { throw null; } public virtual string? GetFileName() { throw null; } public virtual int GetILOffset() { throw null; } - [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Metadata for the method might be incomplete or removed")] + [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("Metadata for the method might be incomplete or removed. Consider using DiagnosticMethodInfo.Create instead")] public virtual System.Reflection.MethodBase? GetMethod() { throw null; } public virtual int GetNativeOffset() { throw null; } public override string ToString() { throw null; } diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackFrame.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackFrame.cs index ff5463bb4cbe1..6041a2c88bf0b 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackFrame.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/StackFrame.cs @@ -138,7 +138,7 @@ public StackFrame(string? fileName, int lineNumber, int colNumber) /// /// Returns the method the frame is executing /// - [RequiresUnreferencedCode("Metadata for the method might be incomplete or removed")] + [RequiresUnreferencedCode("Metadata for the method might be incomplete or removed. Consider using " + nameof(DiagnosticMethodInfo) + "." + nameof(DiagnosticMethodInfo.Create) + " instead")] public virtual MethodBase? GetMethod() { return _method;