Skip to content

When CLR hasn't been initialized in the process, SOS should mention that when commands fail  #2197

@TheJCAB

Description

@TheJCAB

This came up during an investigation of SOS-driven debugging of Time Travel Debugging traces. All SOS commands were failing with varied error messages, but the cause for all failures was ultimately the same. GetThreadStoreData failed because the CLR was loaded but not yet initialized in the debugged process.

Before displaying a specific error for a given command, SOS should verify the current status of the relevant process and thread, and display a better, common message if they are not fully initialized.

These are the sorts of errors that were reported, all having ultimately the same root cause of CLR being uninitialized:

0:004> !clrstack
OS Thread Id: 0x4304 (4)
Unable to walk the managed stack. The current thread is likely not a
managed thread. You can run !threads to get a list of managed threads in
the process
Failed to start stack walk: 80070057
0:004> !dumpheap -stat
Error requesting GC Heap data
Unable to build snapshot of the garbage collector state
0:004> !threads
Failed to request ThreadStore
0:004> !mthreads
No supported CLR version found.
WARNING: Unable to register for CLR module notifications

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions