From e029e54d6d5bfe6a886a761c77eb3f66c3131ac9 Mon Sep 17 00:00:00 2001 From: Brian Robbins Date: Sat, 13 May 2017 11:39:10 -0700 Subject: [PATCH] Disable ETW calls on UNIX. --- src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs | 4 +++- .../src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs b/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs index 440e758..513366f 100644 --- a/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs +++ b/src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs @@ -1468,7 +1468,8 @@ namespace System.Diagnostics.Tracing // Set m_provider, which allows this. m_provider = provider; -#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN && !PLATFORM_UNIX) +#if PLATFORM_WINDOWS +#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN) // API available on OS >= Win 8 and patched Win 7. // Disable only for FrameworkEventSource to avoid recursion inside exception handling. if (this.Name != "System.Diagnostics.Eventing.FrameworkEventSource" || Environment.IsWindows8OrAbove) @@ -1486,6 +1487,7 @@ namespace System.Diagnostics.Tracing metadataHandle.Free(); } +#endif // PLATFORM_WINDOWS #endif // FEATURE_MANAGED_ETW Debug.Assert(!m_eventSourceEnabled); // We can't be enabled until we are completely initted. diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs index bf9e038..a41c069 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs @@ -82,14 +82,14 @@ namespace System.Diagnostics.Tracing public static void SetCurrentThreadActivityId(Guid activityId, out Guid oldActivityThatWillContinue) { oldActivityThatWillContinue = activityId; -#if FEATURE_MANAGED_ETW +#if FEATURE_MANAGED_ETW && PLATFORM_WINDOWS // We ignore errors to keep with the convention that EventSources do not throw errors. // Note we can't access m_throwOnWrites because this is a static method. UnsafeNativeMethods.ManifestEtw.EventActivityIdControl( UnsafeNativeMethods.ManifestEtw.ActivityControl.EVENT_ACTIVITY_CTRL_GET_SET_ID, ref oldActivityThatWillContinue); -#endif // FEATURE_MANAGED_ETW +#endif // FEATURE_MANAGED_ETW && PLATFORM_WINDOWS // We don't call the activityDying callback here because the caller has declared that // it is not dying. @@ -107,11 +107,11 @@ namespace System.Diagnostics.Tracing // We ignore errors to keep with the convention that EventSources do not throw // errors. Note we can't access m_throwOnWrites because this is a static method. Guid retVal = new Guid(); -#if FEATURE_MANAGED_ETW +#if FEATURE_MANAGED_ETW && PLATFORM_WINDOWS UnsafeNativeMethods.ManifestEtw.EventActivityIdControl( UnsafeNativeMethods.ManifestEtw.ActivityControl.EVENT_ACTIVITY_CTRL_GET_ID, ref retVal); -#endif // FEATURE_MANAGED_ETW +#endif // FEATURE_MANAGED_ETW && PLATFORM_WINDOWS return retVal; } } -- 2.7.4