-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new DiagnosticMethodInfo public API (#103220)
Contributes to #96528.
- Loading branch information
1 parent
4443a7d
commit 5b79b76
Showing
20 changed files
with
790 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...nativeaot/System.Private.CoreLib/src/System/Diagnostics/DiagnosticMethodInfo.NativeAot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Internal.Runtime.Augments; | ||
|
||
namespace System.Diagnostics | ||
{ | ||
public sealed partial class DiagnosticMethodInfo | ||
{ | ||
// Public for System.Private.StackTraceMetadata sake | ||
public DiagnosticMethodInfo(string name, string declaringTypeName, string declaringAssemblyName) | ||
=> (Name, DeclaringTypeName, DeclaringAssemblyName) = (name, declaringTypeName, declaringAssemblyName); | ||
|
||
public string Name { get; } | ||
|
||
public string? DeclaringTypeName { get; } | ||
|
||
public string? DeclaringAssemblyName { get; } | ||
|
||
public static DiagnosticMethodInfo? Create(Delegate @delegate) | ||
{ | ||
ArgumentNullException.ThrowIfNull(@delegate); | ||
return @delegate.GetDiagnosticMethodInfo(); | ||
} | ||
|
||
public static DiagnosticMethodInfo? Create(StackFrame frame) | ||
{ | ||
ArgumentNullException.ThrowIfNull(frame); | ||
return frame.TryGetMethodStartAddress(out IntPtr startAddress) | ||
? RuntimeAugments.StackTraceCallbacksIfAvailable?.TryGetDiagnosticMethodInfoFromStartAddress(startAddress) | ||
: null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.