Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ private static Flags InitializeFlags()
{
if (IsUninitialized(s_activeFlags))
{
// The debugger may have set Task.s_asyncDebuggingEnabled directly via ICorDebug
// before any ETW session is established. In that case, s_asyncDebuggerActiveFlags
// will still be Disabled because OnEventCommand was never called. Honor the
// debugger's request by enabling default flags when s_asyncDebuggingEnabled is set.
if (s_asyncDebuggerActiveFlags == Flags.Disabled && Task.s_asyncDebuggingEnabled)
{
s_asyncDebuggerActiveFlags = DefaultFlags | Flags.AsyncDebugger;
}
Comment on lines +110 to +117
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new fallback behavior (enabling AsyncInstrumentation when only Task.s_asyncDebuggingEnabled is set, without an ETW session) doesn’t appear to be covered by existing runtime-async tests. Consider adding a test that sets Task.s_asyncDebuggingEnabled via reflection without creating a TplEventSource listener, then triggers flag initialization (e.g., via a RuntimeAsyncMethodGeneration async method) and asserts AsyncInstrumentation.s_activeFlags becomes enabled (and that the relevant runtime-async collections are initialized as expected).

Copilot uses AI. Check for mistakes.
Comment on lines +114 to +117
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, if Task.s_asyncDebuggingEnabled is later cleared (e.g., debugger detach) in a non-ETW scenario where OnEventCommand never calls UpdateAsyncDebuggerFlags(Disabled), s_asyncDebuggerActiveFlags/s_activeFlags will remain non-Disabled and keep routing RuntimeAsyncTask through the instrumented path (even though AsyncDebugger hooks will be gated by Task.s_asyncDebuggingEnabled). If detach/toggling is expected to work without ETW, consider adding a corresponding “disable” path (e.g., re-check Task.s_asyncDebuggingEnabled in SyncActiveFlags/InstrumentCheckPoint or another explicit update mechanism).

Copilot uses AI. Check for mistakes.

s_activeFlags = s_asyncProfilerActiveFlags | s_asyncDebuggerActiveFlags;
}

Expand Down
Loading