diff options
author | Brian Robbins <brianrob@microsoft.com> | 2017-10-26 21:29:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-26 21:29:50 +0300 |
commit | b87b7d304f85e5adbc665e326ed219bafa7b5eb1 (patch) | |
tree | 95ae5a13387676af7850a30467c22f4d22bd7dbd /src | |
parent | 9b5c2cd0899ac38728d37f61f539ff9b250bb88b (diff) |
Add EventCounter to Microsoft.Diagnostics.Tracing.EventSource.Redist (#24893)
* Share EventSource tests with Microsoft.Diagnostics.Tracing.EventSource.Redist nuget package.
* Add EventCounter to Microsoft.Diagnostics.Tracing.
* Enable EventCounter tests on Microsoft.Diagnostics.Tracing.
Diffstat (limited to 'src')
4 files changed, 6 insertions, 12 deletions
diff --git a/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj b/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj index 33e247edf7..73b96ad67e 100644 --- a/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj +++ b/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/src/Microsoft.Diagnostics.Tracing.EventSource.Redist.csproj @@ -14,7 +14,7 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Debug|AnyCPU'" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Windows_NT-Release|AnyCPU'" /> <ItemGroup> - <!-- <Compile Include="..\..\System.Diagnostics.Tracing\src\System\Diagnostics\Tracing\EventCounter.cs" /> --> + <Compile Include="..\..\System.Diagnostics.Tracing\src\System\Diagnostics\Tracing\EventCounter.cs" /> <Compile Include="*.cs" /> <Compile Include="..\shared\*.cs" /> <Compile Include="..\shared\TraceLogging\*.cs" /> diff --git a/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj b/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj index b76b699b4b..413f7d2b97 100644 --- a/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj +++ b/src/Microsoft.Diagnostics.Tracing.EventSource.Redist/tests/Microsoft.Diagnostics.Tracing.EventSource.Redist.Tests.csproj @@ -17,7 +17,7 @@ <Compile Include="$(SDTTestDir)\BasicEventSourceTest\Harness\EventTestHarness.cs" /> <Compile Include="$(SDTTestDir)\BasicEventSourceTest\FuzzyTests.cs" /> <Compile Include="$(SDTTestDir)\BasicEventSourceTest\Harness\Listeners.cs" /> - <!-- <Compile Include="$(SDTTestDir)\BasicEventSourceTest\TestEventCounter.cs" /> --> + <Compile Include="$(SDTTestDir)\BasicEventSourceTest\TestEventCounter.cs" /> <Compile Include="$(SDTTestDir)\BasicEventSourceTest\TestFilter.cs" /> <Compile Include="$(SDTTestDir)\BasicEventSourceTest\TestShutdown.cs" /> <Compile Include="$(SDTTestDir)\BasicEventSourceTest\TestsEventSourceLifetime.cs" /> diff --git a/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs b/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs index 482909066f..88ab685723 100644 --- a/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs +++ b/src/System.Diagnostics.Tracing/src/System/Diagnostics/Tracing/EventCounter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics; using System.Collections; using System.Collections.Generic; using System.Threading; @@ -361,7 +362,7 @@ namespace System.Diagnostics.Tracing { lock (s_eventCounterGroupsLock) { - int eventSourceIndex = EventListenerHelper.EventSourceIndex(eventSource); + int eventSourceIndex = EventListener.EventSourceIndex(eventSource); EnsureEventSourceIndexAvailable(eventSourceIndex); WeakReference<EventCounterGroup> weakRef = EventCounterGroup.s_eventCounterGroups[eventSourceIndex]; EventCounterGroup ret = null; @@ -486,14 +487,5 @@ namespace System.Diagnostics.Tracing } - // This class a work-around because .NET V4.6.2 did not make EventSourceIndex public (it was only protected) - // We make this helper class to get around that protection. We want V4.6.3 to make this public at which - // point this class is no longer needed and can be removed. - internal class EventListenerHelper : EventListener - { - public new static int EventSourceIndex(EventSource eventSource) { return EventListener.EventSourceIndex(eventSource); } - protected override void OnEventWritten(EventWrittenEventArgs eventData) { } // override abstract methods to keep compiler happy - } - #endregion // internal supporting classes } diff --git a/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs b/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs index 4b8552614c..cbd86c5e84 100644 --- a/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs +++ b/src/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs @@ -48,7 +48,9 @@ namespace BasicEventSourceTests } [Fact] +#if !USE_MDT_EVENTSOURCE [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, reason: "https://github.com/dotnet/corefx/issues/23661")] +#endif [ActiveIssue("https://github.com/dotnet/corefx/issues/22791", TargetFrameworkMonikers.UapAot)] public void Test_Write_Metric_EventListener() { |