dotnet / dotnet/runtime

Follow-up diagnostics work for dynamic metadata-less types in .NET 11

Open
#120,800 4 comments 3 reactions 1 assignee Claimed by @tommcdon View on GitHub
area-Diagnostics-coreclr runtime-async
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

With #120411 merged and with `DOTNET_RuntimeAsync=1` the runtime creates new dynamic Continuation `MethodTables` that do not have associated metadata. This issue captures diagnostics work required to support querying these.

Quoting @noahfalk from https://github.com/dotnet/runtime/pull/120411#discussion_r2422306191:

> * All our APIs that expose object layouts do so in terms of metadata FieldDefs which we don't have here. At minimum we'd be breaking the assumption that the layout information is complete. If we wanted to go farther we could create new layout APIs that aren't backed by metadata tokens.
> [Profiler API](https://learn.microsoft.com/en-us/dotnet/framework/unmanaged-api/profiling/icorprofilerinfo2-getclasslayout-method)
> [Debugger API](https://learn.microsoft.com/en-us/dotnet/core/unmanaged-api/debugging/icordebug/icordebugprocess5-gettypelayout-method)
>
> * In the case of debugging, there is no API that enumerates GC references in an object separate from the layout API. We'd need to create that.
>
> * For debugging, profiling, and GCDumps emitted by events we have algorithms that do GC heap traversal. We'll need to ensure those algorithms are correctly handling these types (this may just fall out for free from the right GCDescs)
>
> * APIs that expose TypeDef tokens for types will need updates not to expose a token for these Continuation sub-types. The behavior change might need changes in the 3rd party tool code to accomodate for it. (ICorDebugClass::GetToken(), ICorProfilerInfo::GetClassIdInfo())

Also quoting @jkotas:
> When designing these APIs, we should generalize them where possible to cover any no metadata types internally created by the runtime. We may want to use them for storing statics and get rid of static boxes.

These APIs may be useful for `InlineArray` types whose metadata does not convey their representation fully.

* [ ] Profiler API not backed by metadata tokens
* [ ] Debugger API not backed by metadata tokens
* [ ] Debugger API to enumerate GC references in an object
* [ ] GC heap traversal
* [ ] Debugger
* [ ] Profiler
* [ ] GC dumps
* [ ] `ICorDebugClass::GetToken`, `ICorProfilerInfo::GetClassIdInfo` fixes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.