dotnet / dotnet/diagnostics

EventListener does not project GCPerHeapHistory_V3 values array

Open
#1,144 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
1.3k
Forks
404
Avg merge
2d 5h
Merged PRs (30d)
35

Description

The [GCPerHeapHistory_V3 event](https://github.com/dotnet/runtime/blob/master/src/coreclr/src/vm/ClrEtwAll.man#L1166) has an array called 'Values'. This array of structs should be projected into the EventListener event model but it is absent. Most likely this is a broader issue handling array typed fields, or perhaps dynamically sized array-typed fields.

Repro:
````C#
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp19
{
class Program
{
static List s_objects = new List();

static void Main(string[] args)
{
GCEventListener listener = new GCEventListener();
Task.Run(AllocateMemory);
Console.ReadLine();
}

static void AllocateMemory()
{
while (true)
{
s_objects.Add(new byte[50_000]);
Thread.Sleep(10);
}
}
}

public class GCEventListener : EventListener
{
enum ClrRuntimeEventKeywords
{
GC = 0x1
}

protected override void OnEventSourceCreated(EventSource eventSource)
{
if (eventSource.Name.Equals("Microsoft-Windows-DotNETRuntime"))
{
EnableEvents(eventSource, EventLevel.Informational, (EventKeywords)ClrRuntimeEventKeywords.GC);
}
}
protected override void OnEventWritten(EventWrittenEventArgs eventData)
{
if (eventData.EventName == "GCPerHeapHistory_V3")
{
Console.WriteLine(eventData.EventName);
foreach (string name in eventData.PayloadNames)
{
Console.WriteLine(" " + name);
}
}
}
}
}
````

**Expected behavior**: this app should print a payload field named "Values" in addition to the others
(and assuming that works you should be able to retrieve the array and access the nested fields)
**Actual behavior**: the app prints over payload fields, but not "Values"

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.