From 53b764ea69fc3ec96448752e7fc4fe9ff39752bb Mon Sep 17 00:00:00 2001 From: Tijoy Tom Kalathiparambil Date: Fri, 7 Apr 2017 13:38:28 -0700 Subject: [PATCH] This's vitek's change. Make EventSource.EventMetadata and EventDescriptor public so that analysis roots them. These types were public in the separate System.Diagnostics.Tracing assembly, now the move to CoreLib marked them as private. While they are technically private (it's a contract used between the library and the ILC toolchain), we need them to be rooted and exported from shared library for the system to work. For now I'm simply marking them as public again. A cleaner solution might be to use .rd.xml to root them and modify shared library definition to force export them. [tfs-changeset: 1653635] --- .../Diagnostics/Tracing/EventDescriptor.cs | 16 +++++++++++++++- .../System/Diagnostics/Tracing/EventSource.cs | 16 +++++++++++++++- .../Diagnostics/Tracing/EventSource_CoreRT.cs | 17 +++++++++++++++-- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs index a1dcf1c5d9a..8fb471a99f7 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventDescriptor.cs @@ -25,7 +25,21 @@ namespace System.Diagnostics.Tracing #if !CORECLR && !ES_BUILD_PN [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] #endif // !CORECLR && !ES_BUILD_PN - internal struct EventDescriptor + + /* + EventDescriptor was public in the separate System.Diagnostics.Tracing assembly(pre NS2.0), + now the move to CoreLib marked them as private. + While they are technically private (it's a contract used between the library and the ILC toolchain), + we need them to be rooted and exported from shared library for the system to work. + For now I'm simply marking them as public again.A cleaner solution might be to use.rd.xml to + root them and modify shared library definition to force export them. + */ +#if ES_BUILD_PN + public +#else + internal +#endif + struct EventDescriptor { # region private [FieldOffset(0)] diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs index 6a1726501d4..9197ed3b726 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/EventSource.cs @@ -2505,7 +2505,21 @@ protected override void OnControllerCommand(ControllerCommand command, IDictiona /// descriptor as well as some stuff we added specifically for EventSource. see the /// code:m_eventData for where we use this. /// - internal partial struct EventMetadata + + /* + EventMetadata was public in the separate System.Diagnostics.Tracing assembly(pre NS2.0), + now the move to CoreLib marked them as private. + While they are technically private (it's a contract used between the library and the ILC toolchain), + we need them to be rooted and exported from shared library for the system to work. + For now I'm simply marking them as public again.A cleaner solution might be to use.rd.xml to + root them and modify shared library definition to force export them. + */ +#if ES_BUILD_PN + public +#else + internal +#endif + partial struct EventMetadata { public EventDescriptor Descriptor; public EventTags Tags; diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource_CoreRT.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource_CoreRT.cs index 97c4b8eed93..9e778549c6d 100644 --- a/src/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource_CoreRT.cs +++ b/src/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource_CoreRT.cs @@ -149,9 +149,22 @@ private Type GetDataType(EventMetadata eventData, int parameterId) return dataType; } - private static readonly bool m_EventSourcePreventRecursion = true; + private static readonly bool m_EventSourcePreventRecursion = true; - internal partial struct EventMetadata + /* + EventMetadata was public in the separate System.Diagnostics.Tracing assembly(pre NS2.0), + now the move to CoreLib marked them as private. + While they are technically private (it's a contract used between the library and the ILC toolchain), + we need them to be rooted and exported from shared library for the system to work. + For now I'm simply marking them as public again.A cleaner solution might be to use.rd.xml to + root them and modify shared library definition to force export them. + */ +#if ES_BUILD_PN + public +#else + internal +#endif + partial struct EventMetadata { public EventMetadata(EventDescriptor descriptor, EventTags tags,