Fix build.
authorBrian Robbins <brianrob@microsoft.com>
Thu, 11 May 2017 01:04:24 +0000 (18:04 -0700)
committerJan Kotas <jkotas@microsoft.com>
Thu, 11 May 2017 23:46:54 +0000 (16:46 -0700)
Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs
src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs

index e5316bc..c8671db 100644 (file)
@@ -124,6 +124,8 @@ namespace System.Diagnostics.Tracing
             m_eventProvider = new EtwEventProvider();
 #elif FEATURE_PERFTRACING
             m_eventProvider = new EventPipeEventProvider();
+#else
+            m_eventProvider = new NoOpEventProvider();
 #endif
         }
 
@@ -475,7 +477,7 @@ namespace System.Diagnostics.Tracing
                 providerInstance = (UnsafeNativeMethods.ManifestEtw.TRACE_PROVIDER_INSTANCE_INFO*)&structBase[providerInstance->NextOffset];
             }
 #else 
-#if !ES_BUILD_PCL && !FEATURE_PAL  // TODO command arguments don't work on PCL builds...
+#if !ES_BUILD_PCL && PLATFORM_WINDOWS  // TODO command arguments don't work on PCL builds...
             // This code is only used in the Nuget Package Version of EventSource.  because
             // the code above is using APIs baned from UWP apps.     
             // 
@@ -559,7 +561,7 @@ namespace System.Diagnostics.Tracing
             dataStart = 0;
             if (filterData == null)
             {
-#if (!ES_BUILD_PCL && !ES_BUILD_PN && !FEATURE_PAL)
+#if (!ES_BUILD_PCL && !ES_BUILD_PN && PLATFORM_WINDOWS)
                 string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerId + "}";
                 if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8)
                     regKey = @"HKEY_LOCAL_MACHINE\Software" + @"\Wow6432Node" + regKey;
@@ -1262,6 +1264,41 @@ namespace System.Diagnostics.Tracing
         }
     }
 
+#elif !FEATURE_PERFTRACING
+
+    internal sealed class NoOpEventProvider : IEventProvider
+    {
+        unsafe uint IEventProvider.EventRegister(
+            ref Guid providerId,
+            UnsafeNativeMethods.ManifestEtw.EtwEnableCallback enableCallback,
+            void* callbackContext,
+            ref long registrationHandle)
+        {
+            return 0;
+        }
+
+        uint IEventProvider.EventUnregister(long registrationHandle)
+        {
+            return 0;
+        }
+
+        unsafe int IEventProvider.EventWriteTransferWrapper(
+            long registrationHandle,
+            ref EventDescriptor eventDescriptor,
+            Guid* activityId,
+            Guid* relatedActivityId,
+            int userDataCount,
+            EventProvider.EventData* userData)
+        {
+            return 0;
+        }
+
+        int IEventProvider.EventActivityIdControl(UnsafeNativeMethods.ManifestEtw.ActivityControl ControlCode, ref Guid ActivityId)
+        {
+            return 0;
+        }
+    }
+
 #endif
 }
 
index 483b1f8..440e758 100644 (file)
@@ -4,7 +4,7 @@
 
 // This program uses code hyperlinks available as part of the HyperAddin Visual Studio plug-in.
 // It is available from http://www.codeplex.com/hyperAddin 
-#if !ES_BUILD_STANDALONE && !CORECLR && !ES_BUILD_PN
+#if PLATFORM_WINDOWS && !ES_BUILD_STANDALONE && !CORECLR && !ES_BUILD_PN
 #define FEATURE_ACTIVITYSAMPLING
 #endif // !ES_BUILD_STANDALONE