Skip to content

Commit 082123b

Browse files
authored
events from private provider not getting fire if process starts after event collection starts (#117836)
fixes issue #115420. please see description of the problem in that issue.
1 parent 00d5d41 commit 082123b

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/coreclr/vm/eventtrace.cpp

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,29 +2683,39 @@ extern "C"
26832683
ClrFlsThreadTypeSwitch etwRundownThreadHolder(ThreadType_ETWRundownThread);
26842684
PMCGEN_TRACE_CONTEXT context = (PMCGEN_TRACE_CONTEXT)CallbackContext;
26852685

2686-
BOOLEAN bIsPublicTraceHandle = (context->RegistrationHandle==Microsoft_Windows_DotNETRuntimeHandle);
2686+
BOOLEAN bIsPublicTraceHandle = (context == MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context.EtwProvider);
26872687

2688-
BOOLEAN bIsPrivateTraceHandle = (context->RegistrationHandle==Microsoft_Windows_DotNETRuntimePrivateHandle);
2688+
BOOLEAN bIsPrivateTraceHandle = (context == MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_DOTNET_Context.EtwProvider);
26892689

2690-
BOOLEAN bIsRundownTraceHandle = (context->RegistrationHandle==Microsoft_Windows_DotNETRuntimeRundownHandle);
2690+
BOOLEAN bIsRundownTraceHandle = (context == MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_DOTNET_Context.EtwProvider);
2691+
2692+
BOOLEAN bIsStressTraceHandle = (context == MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_DOTNET_Context.EtwProvider);
26912693

26922694
// EventPipeEtwCallback contains some GC eventing functionality shared between EventPipe and ETW.
26932695
// Eventually, we'll want to merge these two codepaths whenever we can.
26942696
CallbackProviderIndex providerIndex = DotNETRuntime;
26952697
DOTNET_TRACE_CONTEXT providerContext = MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context;
2696-
if (context->RegistrationHandle == Microsoft_Windows_DotNETRuntimeHandle) {
2698+
if (bIsPublicTraceHandle)
2699+
{
26972700
providerIndex = DotNETRuntime;
26982701
providerContext = MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_DOTNET_Context;
2699-
} else if (context->RegistrationHandle == Microsoft_Windows_DotNETRuntimeRundownHandle) {
2702+
}
2703+
else if (bIsRundownTraceHandle)
2704+
{
27002705
providerIndex = DotNETRuntimeRundown;
27012706
providerContext = MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_DOTNET_Context;
2702-
} else if (context->RegistrationHandle == Microsoft_Windows_DotNETRuntimeStressHandle) {
2707+
}
2708+
else if (bIsStressTraceHandle)
2709+
{
27032710
providerIndex = DotNETRuntimeStress;
27042711
providerContext = MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_DOTNET_Context;
2705-
} else if (context->RegistrationHandle == Microsoft_Windows_DotNETRuntimePrivateHandle) {
2712+
}
2713+
else if (bIsPrivateTraceHandle)
2714+
{
27062715
providerIndex = DotNETRuntimePrivate;
27072716
providerContext = MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_DOTNET_Context;
2708-
} else {
2717+
}
2718+
else {
27092719
assert(!"unknown registration handle");
27102720
return;
27112721
}

0 commit comments

Comments
 (0)