Repository navigation
Implement TypeHandle::GetName in managed cDAC - #131336
Conversation
Co-authored-by: rcj1 <[email protected]>
Co-authored-by: rcj1 <[email protected]>
Co-authored-by: rcj1 <[email protected]>
Co-authored-by: rcj1 <[email protected]>
|
Azure Pipelines: Successfully started running 4 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeTypeSystem.cs:250
- Changing IRuntimeTypeSystem.IsGenericVariable to add an extra out parameter is a source/binary breaking change for any external consumers (the Abstractions project is packable). To preserve compatibility, keep the existing 3-out signature and add the new 4-out overload, with the 3-out overload delegating to the 4-out overload (discarding index).
// return true if the ITypeHandle represents an array, and set the rank to either 0 (if the type is not an array), or the rank number if it is.
bool IsArray(ITypeHandle typeHandle, out uint rank) => throw new NotImplementedException();
ITypeHandle GetTypeParam(ITypeHandle typeHandle) => throw new NotImplementedException();
ITypeHandle? GetConstructedType(ITypeHandle? typeHandle, CorElementType corElementType, int rank, ImmutableArray<ITypeHandle?> typeArguments, SignatureCallingConvention callConv = SignatureCallingConvention.Default) => throw new NotImplementedException();
ITypeHandle GetPrimitiveType(CorElementType typeCode) => throw new NotImplementedException();
bool IsGenericVariable(ITypeHandle typeHandle, out TargetPointer module, out uint token, out uint index) => throw new NotImplementedException();
bool IsFunctionPointer(ITypeHandle typeHandle, out ReadOnlySpan<ITypeHandle> retAndArgTypes, out SignatureCallingConvention callConv) => throw new NotImplementedException();
- Files reviewed: 13/13 changed files
- Comments generated: 0 new
davidwrighton
left a comment
There was a problem hiding this comment.
Just the one change around function pointer handling. Also I'd like to see us file a bug to remove this name builder and just use the TypeNameBuilder. I know the semantics aren't quite the same, but once we stop testing against the legacy implementation of the DAC we should stop using this.
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Contracts/IRuntimeTypeSystem.cs:250
- Changing the
IRuntimeTypeSystem.IsGenericVariablesignature to add a newout uint indexis a binary/source breaking change for any downstream consumers that implement or call this contract (the Abstractions project isIsPackable=true). If compatibility matters, keep the existing 3-parameter overload and add a new overload (or new method name) that providesindex, with a default interface implementation delegating to the new API while discardingindex.
// return true if the ITypeHandle represents an array, and set the rank to either 0 (if the type is not an array), or the rank number if it is.
bool IsArray(ITypeHandle typeHandle, out uint rank) => throw new NotImplementedException();
ITypeHandle GetTypeParam(ITypeHandle typeHandle) => throw new NotImplementedException();
ITypeHandle? GetConstructedType(ITypeHandle? typeHandle, CorElementType corElementType, int rank, ImmutableArray<ITypeHandle?> typeArguments, SignatureCallingConvention callConv = SignatureCallingConvention.Default) => throw new NotImplementedException();
ITypeHandle GetPrimitiveType(CorElementType typeCode) => throw new NotImplementedException();
bool IsGenericVariable(ITypeHandle typeHandle, out TargetPointer module, out uint token, out uint index) => throw new NotImplementedException();
bool IsFunctionPointer(ITypeHandle typeHandle, out ReadOnlySpan<ITypeHandle> retAndArgTypes, out SignatureCallingConvention callConv) => throw new NotImplementedException();
- Files reviewed: 13/13 changed files
- Comments generated: 1
<!-- --> Adds managed type-handle naming with output matching native `TypeHandle::GetName`. - **Implementation** - Formats MethodTables, TypeDescs, modifiers, generic variables, function pointers, instantiations, and arrays. - Reuses `TypeNameBuilder` generic-instantiation formatting. - **Coverage** - Adds cross-architecture parity tests for supported type shapes and array-rank behavior. We need this for example to implement ClrDataTypeInstance.GetName. This has some different behavior than the existing TypeNameBuilder - for example, function pointers are displayed as "FNPTR" instead of attempting to resolve further details. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: rcj1 <[email protected]> Co-authored-by: rcj1 <[email protected]>
<!-- --> Adds managed type-handle naming with output matching native `TypeHandle::GetName`. - **Implementation** - Formats MethodTables, TypeDescs, modifiers, generic variables, function pointers, instantiations, and arrays. - Reuses `TypeNameBuilder` generic-instantiation formatting. - **Coverage** - Adds cross-architecture parity tests for supported type shapes and array-rank behavior. We need this for example to implement ClrDataTypeInstance.GetName. This has some different behavior than the existing TypeNameBuilder - for example, function pointers are displayed as "FNPTR" instead of attempting to resolve further details. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: rcj1 <[email protected]> Co-authored-by: rcj1 <[email protected]>
Adds managed type-handle naming with output matching native
TypeHandle::GetName.Implementation
TypeNameBuildergeneric-instantiation formatting.Coverage
We need this for example to implement ClrDataTypeInstance.GetName. This has some different behavior than the existing TypeNameBuilder - for example, function pointers are displayed as "FNPTR" instead of attempting to resolve further details.