Disable ETW calls on UNIX.
authorBrian Robbins <brianrob@microsoft.com>
Sat, 13 May 2017 18:39:10 +0000 (11:39 -0700)
committerBrian Robbins <brianrob@microsoft.com>
Sat, 13 May 2017 18:39:10 +0000 (11:39 -0700)
src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs
src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs

index 440e758..513366f 100644 (file)
@@ -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.  
index bf9e038..a41c069 100644 (file)
@@ -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;
             }
         }