-
Notifications
You must be signed in to change notification settings - Fork 4k
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
EE: Support compact name in IDkmLanguageInstructionDecoder.GetMethodName()
implementation
#75764
Conversation
…ame() implementation
/azp run roslyn-CI |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -38,16 +38,24 @@ string IDkmLanguageInstructionDecoder.GetMethodName(DkmLanguageInstructionAddres | |||
// but it was ignored. Furthermore, it's not clear what FullNames would mean with respect | |||
// to argument names in C# or Visual Basic. For consistency with the old behavior, we'll | |||
// just ignore the flag as well. | |||
Debug.Assert((argumentFlags & (DkmVariableInfoFlags.FullNames | DkmVariableInfoFlags.Names | DkmVariableInfoFlags.Types)) == argumentFlags, | |||
Debug.Assert((argumentFlags & (DkmVariableInfoFlags.FullNames | DkmVariableInfoFlags.Names | DkmVariableInfoFlags.Types | DkmVariableInfoFlags.CompactName)) == argumentFlags, |
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.
Curious where will the CompactName be used exactly in VS/EE UI? #Closed
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.
TBD.
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.
@jjonescz FWIW, here's the doc for the new flag:
// Summary:
// If specified, the expression evaluator will create a very compact name for the
// frame. This is intended for UI presentation in cases where screen space is very
// limited. The suggested implementation is to return only the method name, with
// no namespace, class name, or generic arguments.
/azp run roslyn-CI |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -36,7 +36,8 @@ private CSharpInstructionDecoder() | |||
|
|||
internal override string GetCompactName(MethodSymbol method) | |||
{ | |||
return (method.AssociatedSymbol ?? method).Name; | |||
var symbol = method.AssociatedSymbol ?? method; | |||
return symbol.ToDisplayString(CompactNameFormat); |
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.
Why did you change this from Name
to DisplayString? #Resolved
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.
We're using ToDisplayString()
so the member name in the string returned from IDkmLanguageInstructionDecoder.GetMethodName()
is consistent regardless of whether DkmVariableInfoFlags.CompactName
is used. See table in PR description.
@dotnet/roslyn-compiler for a second review, thanks. |
src/ExpressionEvaluator/Core/Source/ExpressionCompiler/LanguageInstructionDecoder.cs
Show resolved
Hide resolved
src/ExpressionEvaluator/Core/Source/ExpressionCompiler/InstructionDecoder.cs
Outdated
Show resolved
Hide resolved
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/InstructionDecoderTests.cs
Outdated
Show resolved
Hide resolved
src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/InstructionDecoderTests.cs
Show resolved
Hide resolved
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.
Done with review pass (iteration 2)
@@ -34,6 +34,18 @@ private CSharpInstructionDecoder() | |||
AddMemberOptions(SymbolDisplayMemberOptions.IncludeParameters). | |||
WithParameterOptions(SymbolDisplayParameterOptions.IncludeType); | |||
|
|||
internal static readonly SymbolDisplayFormat s_indexerCompactNameFormat = CompactNameFormat. | |||
WithMemberOptions(SymbolDisplayMemberOptions.IncludeParameters); |
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.
nit: may be worth a comment or making SymbolDisplayParameterOptions.None
explicit for clarity #Closed
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 Thanks (iteration 4)
The compact name is simply the method metadata name without arguments or type arguments, or for an accessor, the property or event name.
The table below includes differences between the strings returned from
GetMethodName()
with and withoutDkmVariableInfoFlags.CompactName
.M
C.M
P
C.P.get
this[]
C.this[int].get
C
C.C
~C
C.~C
operator +
C.operator +
implicit operator int
C.implicit operator int