Repository: dotnet/runtime
File: src/mono/wasm/Wasm.Build.Tests/Blazor/EventPipeDiagnosticsTests.cs (C#)

Code before:
            }
        ));

        var actualInstruments = ExtractInstrumentNames(info, "metrics.nettrace");
        var expectedInstruments = new[]
        {
            "System.Diagnostics.Metrics/instrumentName/dotnet.assembly.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.exceptions",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.collections",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.heap.total_allocated",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.last_collection.heap.fragmentation.size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.last_collection.heap.size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.last_collection.memory.committed_size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.pause.time",
            "System.Diagnostics.Metrics/instrumentName/dotnet.jit.compilation.time",
            "System.Diagnostics.Metrics/instrumentName/dotnet.jit.compiled_il.size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.jit.compiled_methods",
            "System.Diagnostics.Metrics/instrumentName/dotnet.monitor.lock_contentions",
            "System.Diagnostics.Metrics/instrumentName/dotnet.process.cpu.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.process.memory.working_set",
            "System.Diagnostics.Metrics/instrumentName/dotnet.thread_pool.queue.length",
            "System.Diagnostics.Metrics/instrumentName/dotnet.thread_pool.thread.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.thread_pool.work_item.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.timer.count",
            "Microsoft-DotNETCore-EventPipe/ArchInformation/Unknown",
            "Microsoft-DotNETCore-EventPipe/OSInformation/Unknown"
        };

        foreach (var expectedInstrument in expectedInstruments)
        {
            Assert.True(actualInstruments.ContainsKey(expectedInstrument), $"The metrics.nettrace should contain instrument: {expectedInstrument}");
        }
    }

    [Fact]
    public async Task BlazorEventPipeTestWithHeapDump()
    {
        string extraProperties = @"
                <EnableDiagnostics>true</EnableDiagnostics>
                <WBTDevServer>true</WBTDevServer>
            ";

        ProjectInfo info = CopyTestAsset(Configuration.Release, aot: false, TestAsset.BlazorBasicTestApp, "blazor_gc_dump", extraProperties: extraProperties);

        UpdateCounterPage();

        // Build the project
        BuildProject(info, Configuration.Release, new BuildOptions(AssertAppBundle: false));

        // Create a custom test handler that will navigate to Counter page, collect CPU samples,
        // click the button, and upload the trace

Review comment (suggestion):
The expected instrument "Microsoft-DotNETCore-EventPipe/CommandLine//managed BlazorBasicTestApp" was removed from the assertions. Please clarify whether this is intentional (e.g., the event is no longer emitted with the new timing/execution model) or if this represents a regression that should be investigated. If intentional, consider adding a comment explaining why this event is no longer expected.

Code after:
            }
        ));

        var actualInstruments = ExtractInstrumentNames(info, "metrics.nettrace");
        var expectedInstruments = new[]
        {
            "System.Diagnostics.Metrics/instrumentName/dotnet.assembly.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.exceptions",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.collections",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.heap.total_allocated",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.last_collection.heap.fragmentation.size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.last_collection.heap.size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.last_collection.memory.committed_size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.gc.pause.time",
            "System.Diagnostics.Metrics/instrumentName/dotnet.jit.compilation.time",
            "System.Diagnostics.Metrics/instrumentName/dotnet.jit.compiled_il.size",
            "System.Diagnostics.Metrics/instrumentName/dotnet.jit.compiled_methods",
            "System.Diagnostics.Metrics/instrumentName/dotnet.monitor.lock_contentions",
            "System.Diagnostics.Metrics/instrumentName/dotnet.process.cpu.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.process.memory.working_set",
            "System.Diagnostics.Metrics/instrumentName/dotnet.thread_pool.queue.length",
            "System.Diagnostics.Metrics/instrumentName/dotnet.thread_pool.thread.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.thread_pool.work_item.count",
            "System.Diagnostics.Metrics/instrumentName/dotnet.timer.count",
        };

        foreach (var expectedInstrument in expectedInstruments)
        {
            Assert.True(actualInstruments.ContainsKey(expectedInstrument), $"The metrics.nettrace should contain instrument: {expectedInstrument}");
        }
    }

    [Fact]
    public async Task BlazorEventPipeTestWithHeapDump()
    {
        string extraProperties = @"
                <EnableDiagnostics>true</EnableDiagnostics>
                <WBTDevServer>true</WBTDevServer>
            ";

        ProjectInfo info = CopyTestAsset(Configuration.Release, aot: false, TestAsset.BlazorBasicTestApp, "blazor_gc_dump", extraProperties: extraProperties);

        UpdateCounterPage();

        // Build the project
        BuildProject(info, Configuration.Release, new BuildOptions(AssertAppBundle: false));

        // Create a custom test handler that will navigate to Counter page, collect CPU samples,
        // click the button, and upload the trace
        async Task CollectGcDumpTest(IPage page)
        {