Skip to content

EventCounters event is written to an EventListener that never subscribed to it #31500

@pakrym

Description

@pakrym

We have an EventListener listener where the subscription is guarded by a trait that System.Runtime event source doesn't have (TraitName = "AzureEventSource")

  protected sealed override void OnEventSourceCreated(EventSource eventSource)
        {
            base.OnEventSourceCreated(eventSource);

            if (eventSource.GetTrait(TraitName) == TraitValue)
            {
                EnableEvents(eventSource, _level);
            }
        }

Somehow without subscribing to System.Runtime event source we get EventCounters events with the following stack:

>	Azure.Core.dll!Azure.Core.Diagnostics.AzureEventSourceListener.OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) Line 70	C#
 	System.Private.CoreLib.dll!System.Diagnostics.Tracing.EventSource.DispatchToAllListeners(int eventId, System.Guid* childActivityID, System.Diagnostics.Tracing.EventWrittenEventArgs eventCallbackArgs) Line 2166	C#
 	System.Private.CoreLib.dll!System.Diagnostics.Tracing.EventSource.WriteToAllListeners(string eventName, ref System.Diagnostics.Tracing.EventDescriptor eventDescriptor, System.Diagnostics.Tracing.EventTags tags, System.Guid* pActivityId, System.Guid* pChildActivityId, System.Diagnostics.Tracing.EventPayload payload) Line 747	C#
 	System.Private.CoreLib.dll!System.Diagnostics.Tracing.EventSource.WriteImpl(string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, object data, System.Guid* pActivityId, System.Guid* pRelatedActivityId, System.Diagnostics.Tracing.TraceLoggingEventTypes eventTypes) Line 695	C#
 	System.Private.CoreLib.dll!System.Diagnostics.Tracing.PollingCounter.WritePayload(float intervalSec, int pollingIntervalMillisec) Line 76	C#
 	System.Private.CoreLib.dll!System.Diagnostics.Tracing.CounterGroup.OnTimer() Line 224	C#
 	System.Private.CoreLib.dll!System.Diagnostics.Tracing.CounterGroup.PollForValues() Line 251	C#
 	System.Private.CoreLib.dll!System.Threading.ThreadHelper.ThreadStart() Line 100	C#

EventData:


  | Name | Value | Type
-- | -- | -- | --
◢ | eventData | {System.Diagnostics.Tracing.EventWrittenEventArgs} | System.Diagnostics.Tracing.EventWrittenEventArgs
  | ▶ ActivityId | {00000000-0000-0000-0000-000000000000} | System.Guid
  | Channel | None | System.Diagnostics.Tracing.EventChannel
  | EventId | -1 | int
  | EventName | "EventCounters" | string
  | ▶ EventSource | {EventSource(System.Runtime, 49592c0f-5a05-516d-aa4b-a64e02026c89)} | System.Diagnostics.Tracing.EventSource {System.Diagnostics.Tracing.RuntimeEventSource}
  | Keywords | None | System.Diagnostics.Tracing.EventKeywords
  | Level | LogAlways | System.Diagnostics.Tracing.EventLevel
  | Message | null | string
  | OSThreadId | 36244 | long
  | Opcode | Info | System.Diagnostics.Tracing.EventOpcode
  | ▶ Payload | Count = 1 | System.Collections.ObjectModel.ReadOnlyCollection<object>
  | ▶ PayloadNames | Count = 1 | System.Collections.ObjectModel.ReadOnlyCollection<string>
  | ▶ RelatedActivityId | {00000000-0000-0000-0000-000000000000} | System.Guid
  | Tags | None | System.Diagnostics.Tracing.EventTags
  | Task | None | System.Diagnostics.Tracing.EventTask
  | ▶ TimeStamp | {11/14/2019 7:38:14 PM} | System.DateTime
  | Version | 0 | byte


Runtime version: 3.0.0

cc @noahfalk

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions