diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs index 57c7f003cc4ad0..c3c022d3dfc26d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventProvider.cs @@ -486,7 +486,7 @@ internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr even Debug.Assert(EtwAPIMaxRefObjCount == 8, $"{nameof(EtwAPIMaxRefObjCount)} must equal the number of fields in {nameof(EightObjects)}"); EightObjects eightObjectStack = default; Span refObjPosition = stackalloc int[EtwAPIMaxRefObjCount]; - Span dataRefObj = new Span(ref eightObjectStack._arg0, EtwAPIMaxRefObjCount); + Span dataRefObj = eightObjectStack; EventData* userData = stackalloc EventData[2 * argCount]; for (int i = 0; i < 2 * argCount; i++) @@ -653,21 +653,6 @@ internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, IntPtr even return true; } - /// Workaround for inability to stackalloc object[EtwAPIMaxRefObjCount == 8]. - private struct EightObjects - { - internal object? _arg0; -#pragma warning disable CA1823, CS0169, IDE0051, IDE0044 - private object? _arg1; - private object? _arg2; - private object? _arg3; - private object? _arg4; - private object? _arg5; - private object? _arg6; - private object? _arg7; -#pragma warning restore CA1823, CS0169, IDE0051, IDE0044 - } - /// /// WriteEvent, method to be used by generated code on a derived class ///