-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix System.Diagnostics.PerformanceCounter diag overlap
- Loading branch information
1 parent
3159c85
commit a5ac25d
Showing
14 changed files
with
119 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...guration.ConfigurationManager/ref/System.Configuration.ConfigurationManager.netcoreapp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// ------------------------------------------------------------------------------ | ||
// Changes to this file must follow the https://aka.ms/api-review process. | ||
// ------------------------------------------------------------------------------ | ||
|
||
namespace System.Diagnostics | ||
{ | ||
public static partial class TraceConfiguration | ||
{ | ||
public static void Register() { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
.../System/Diagnostics/PerfCounterSection.cs → ...System/Diagnostics/PerfCounterSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Configuration; | ||
|
||
namespace System.Diagnostics | ||
{ | ||
internal sealed class PerfCounterSection : ConfigurationElement | ||
public sealed class PerfCounterSettings : ConfigurationElement | ||
{ | ||
private static readonly ConfigurationProperty s_propFileMappingSize = new ConfigurationProperty("filemappingsize", typeof(int), 524288, ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationPropertyCollection s_properties = new ConfigurationPropertyCollection { s_propFileMappingSize }; | ||
|
||
[ConfigurationProperty("filemappingsize", DefaultValue = 524288)] | ||
public int FileMappingSize => (int)this[s_propFileMappingSize]; | ||
|
||
protected override ConfigurationPropertyCollection Properties => s_properties; | ||
protected internal override ConfigurationPropertyCollection Properties => s_properties; | ||
} | ||
} |
36 changes: 10 additions & 26 deletions
36
...tem.Configuration.ConfigurationManager/src/System/Diagnostics/SystemDiagnosticsSection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Configuration; | ||
|
||
namespace System.Diagnostics | ||
{ | ||
internal sealed class SystemDiagnosticsSection : ConfigurationSection | ||
public sealed partial class SystemDiagnosticsSection : ConfigurationSection | ||
{ | ||
private static readonly ConfigurationPropertyCollection s_properties = new(); | ||
private static readonly ConfigurationProperty s_propSources = new("sources", typeof(SourceElementsCollection), new SourceElementsCollection(), ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationProperty s_propSharedListeners = new("sharedListeners", typeof(SharedListenerElementsCollection), new SharedListenerElementsCollection(), ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationProperty s_propSwitches = new("switches", typeof(SwitchElementsCollection), new SwitchElementsCollection(), ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationProperty s_propTrace = new("trace", typeof(TraceSection), new TraceSection(), ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationProperty s_propPerfCounters = new ConfigurationProperty("performanceCounters", typeof(PerfCounterSettings), new PerfCounterSettings(), ConfigurationPropertyOptions.None); | ||
|
||
static SystemDiagnosticsSection() | ||
{ | ||
s_properties.Add(s_propSources); | ||
s_properties.Add(s_propSharedListeners); | ||
s_properties.Add(s_propSwitches); | ||
s_properties.Add(s_propTrace); | ||
s_properties.Add(s_propPerfCounters); | ||
|
||
#if NET7_0_OR_GREATER | ||
SystemDiagnosticsSectionNetCoreApp(); | ||
#endif | ||
} | ||
|
||
protected internal override ConfigurationPropertyCollection Properties => s_properties; | ||
|
||
[ConfigurationProperty("sources")] | ||
public SourceElementsCollection Sources => (SourceElementsCollection)base[s_propSources]; | ||
|
||
[ConfigurationProperty("sharedListeners")] | ||
public ListenerElementsCollection SharedListeners => (ListenerElementsCollection)base[s_propSharedListeners]; | ||
|
||
[ConfigurationProperty("switches")] | ||
public SwitchElementsCollection Switches => (SwitchElementsCollection)base[s_propSwitches]; | ||
|
||
[ConfigurationProperty("trace")] | ||
public TraceSection Trace => (TraceSection)base[s_propTrace]; | ||
|
||
protected internal override void InitializeDefault() | ||
{ | ||
Trace.Listeners?.InitializeDefaultInternal(); | ||
} | ||
[ConfigurationProperty("performanceCounters")] | ||
public PerfCounterSettings PerfCounterSettings => (PerfCounterSettings)base[s_propPerfCounters]; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...ration.ConfigurationManager/src/System/Diagnostics/SystemDiagnosticsSection.netcoreapp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Configuration; | ||
|
||
namespace System.Diagnostics | ||
{ | ||
public partial class SystemDiagnosticsSection | ||
{ | ||
private static readonly ConfigurationProperty s_propSources = new("sources", typeof(SourceElementsCollection), new SourceElementsCollection(), ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationProperty s_propSharedListeners = new("sharedListeners", typeof(SharedListenerElementsCollection), new SharedListenerElementsCollection(), ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationProperty s_propSwitches = new("switches", typeof(SwitchElementsCollection), new SwitchElementsCollection(), ConfigurationPropertyOptions.None); | ||
private static readonly ConfigurationProperty s_propTrace = new("trace", typeof(TraceSection), new TraceSection(), ConfigurationPropertyOptions.None); | ||
|
||
private static void SystemDiagnosticsSectionNetCoreApp() | ||
{ | ||
s_properties.Add(s_propSources); | ||
s_properties.Add(s_propSharedListeners); | ||
s_properties.Add(s_propSwitches); | ||
s_properties.Add(s_propTrace); | ||
} | ||
|
||
[ConfigurationProperty("sources")] | ||
internal SourceElementsCollection Sources => (SourceElementsCollection)base[s_propSources]; | ||
|
||
[ConfigurationProperty("sharedListeners")] | ||
internal ListenerElementsCollection SharedListeners => (ListenerElementsCollection)base[s_propSharedListeners]; | ||
|
||
[ConfigurationProperty("switches")] | ||
internal SwitchElementsCollection Switches => (SwitchElementsCollection)base[s_propSwitches]; | ||
|
||
[ConfigurationProperty("trace")] | ||
internal TraceSection Trace => (TraceSection)base[s_propTrace]; | ||
|
||
protected internal override void InitializeDefault() | ||
{ | ||
Trace.Listeners?.InitializeDefaultInternal(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
.../System.Diagnostics.PerformanceCounter/src/System/Diagnostics/SystemDiagnosticsSection.cs
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...tics.TraceSource/tests/System.Diagnostics.TraceSource.Config.Tests/StringTraceListener.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters