Skip to content

Thread statics are no longer visible in debugger #89227

@MichalStrehovsky

Description

@MichalStrehovsky
using System;

new Program();

partial class Program
{
    [ThreadStatic]
    static int Value;

    public Program()
    {
        // Put this expression in the Watch window: tls_Program::__THREADSTATICINDEX.Get()->Value
        // "tls" is the name of the assembly.
        // "Program" is the containing type
        // "Value" is the name of the threadstatic
        Value = 123;
        Value = 456;
    }
}

Compiling this with .NET 7 Native AOT, the thread static was visible in the debugger:

image

After compiling this with .NET 8, the thread static is no longer inspectable.

We might need to adjust the natvis to whatever is the new way to access the threadstatics:

See dotnet/runtimelab#1313 for the original PR that added support for this.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions