-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add new DiagnosticMethodInfo public API #103220
Add new DiagnosticMethodInfo public API #103220
Conversation
Note regarding the
|
1 similar comment
Note regarding the
|
Tagging subscribers to this area: @tommcdon |
DiagnosticMethodInfo? dmi = DiagnosticMethodInfo.Create(@delegate); | ||
return dmi?.Name ?? "<unknown>"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could alternatively be this, but not sure how important that is:
DiagnosticMethodInfo? dmi = DiagnosticMethodInfo.Create(@delegate); | |
return dmi?.Name ?? "<unknown>"; | |
if (StackTrace.IsSupported) | |
{ | |
DiagnosticMethodInfo? dmi = DiagnosticMethodInfo.Create(@delegate); | |
return dmi!.Name; | |
} | |
else | |
{ | |
return @delegate.Method.Name; | |
} |
/azp run runtime-nativeaot-outerloop |
Azure Pipelines successfully started running 1 pipeline(s). |
1.1% size savings on webapiaot! MichalStrehovsky/rt-sz#29 (comment) |
This is ready for review, cc @dotnet/ilc-contrib |
@@ -1681,7 +1681,7 @@ internal void ScheduleAndStart(bool needsProtection) | |||
{ | |||
// For all other task than TaskContinuations we want to log. TaskContinuations log in their constructor | |||
Debug.Assert(m_action != null, "Must have a delegate to be in ScheduleAndStart"); | |||
TplEventSource.Log.TraceOperationBegin(this.Id, "Task: " + m_action.Method.Name, 0); | |||
TplEventSource.Log.TraceOperationBegin(this.Id, "Task: " + m_action.GetMethodName(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this measurably more expensive than the existing code on regular CoreCLR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On regular coreclr there's the one extra allocation but otherwise I don't expect impact. DiagnosticMethodInfo just wraps the underlying MethodInfo.
On native AOT we unnecessarily materialize type name and class name. I thought about structuring DiagnosticMethodInfo so that it wraps MetadataReader and a bunch of handles but ended up not doing it because we'd still need strings for the open method delegate cases (or somehow wrestle metadata handles out of reflection objects in that case).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This add support for the new public API for all runtime flavors and switches Tasks logging to use it (we could make it a separate PR, I don't mind either way). Switching tasks logging to the new API saves 1.1% in size on webapiaot because the compiler no longer needs to consider all delegates targets of reflection.
TODO:
<StackTraceSupport>false</StackTraceSupport>
really means this doesn't work.get_Method
.#96528