diff options
author | David Mason <davmason@microsoft.com> | 2016-07-26 13:27:10 -0700 |
---|---|---|
committer | David Mason <davmason@microsoft.com> | 2016-07-27 12:52:44 -0700 |
commit | 856ae899dc2414c6806152648c17d5d312b3aee6 (patch) | |
tree | caaa0f4a01423c7c2bef57fe87996cc0238d2d20 /src | |
parent | 9d7584d057021e0ca7cb69eefcda68ba011d2bd8 (diff) | |
download | coreclr-856ae899dc2414c6806152648c17d5d312b3aee6.tar.gz coreclr-856ae899dc2414c6806152648c17d5d312b3aee6.tar.bz2 coreclr-856ae899dc2414c6806152648c17d5d312b3aee6.zip |
porting changes from .net native to CoreCLR
Diffstat (limited to 'src')
5 files changed, 29 insertions, 25 deletions
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs index cad47eeb5b..b1f946464e 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs @@ -1,4 +1,8 @@ -using System; +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; using System.Collections; using System.Collections.Generic; using System.Threading; @@ -26,12 +30,12 @@ namespace System.Diagnostics.Tracing { if (name == null) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } if (eventSource == null) { - throw new ArgumentNullException("eventSource"); + throw new ArgumentNullException(nameof(eventSource)); } InitializeBuffer(); @@ -281,7 +285,7 @@ namespace System.Diagnostics.Tracing else if (eventSourceIndex >= EventCounterGroup.s_eventCounterGroups.Length) { EventCounterGroup[] newEventCounterGroups = new EventCounterGroup[eventSourceIndex + 1]; - Array.Copy(EventCounterGroup.s_eventCounterGroups, newEventCounterGroups, EventCounterGroup.s_eventCounterGroups.Length); + Array.Copy(EventCounterGroup.s_eventCounterGroups, 0, newEventCounterGroups, 0, EventCounterGroup.s_eventCounterGroups.Length); EventCounterGroup.s_eventCounterGroups = newEventCounterGroups; } } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs index 4361bdefd7..11b6e6bac2 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs @@ -73,12 +73,12 @@ namespace System.Diagnostics.Tracing { if (id < 0) { - throw new ArgumentOutOfRangeException("id", Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); + throw new ArgumentOutOfRangeException(nameof(id), Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); } if (id > ushort.MaxValue) { - throw new ArgumentOutOfRangeException("id", Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue)); + throw new ArgumentOutOfRangeException(nameof(id), Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue)); } m_traceloggingId = 0; @@ -91,12 +91,12 @@ namespace System.Diagnostics.Tracing if (task < 0) { - throw new ArgumentOutOfRangeException("task", Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); + throw new ArgumentOutOfRangeException(nameof(task), Resources.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); } if (task > ushort.MaxValue) { - throw new ArgumentOutOfRangeException("task", Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue)); + throw new ArgumentOutOfRangeException(nameof(task), Resources.GetResourceString("ArgumentOutOfRange_NeedValidId", 1, ushort.MaxValue)); } m_task = (ushort)task; diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs index 2b0807f4ee..6ea8d98d92 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs @@ -89,7 +89,7 @@ namespace System.Diagnostics.Tracing private static WriteEventErrorCode s_returnCode; // The last return code private const int s_basicTypeAllocationBufferSize = 16; - private const int s_etwMaxNumberArguments = 64; + private const int s_etwMaxNumberArguments = 128; private const int s_etwAPIMaxRefObjCount = 8; private const int s_maxEventDataDescriptors = 128; private const int s_traceEventMaximumSize = 65482; @@ -560,7 +560,7 @@ namespace System.Diagnostics.Tracing dataStart = 0; if (filterData == null) { -#if !ES_BUILD_PCL && !FEATURE_PAL +#if (!ES_BUILD_PCL && !PROJECTN && !FEATURE_PAL) 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; diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs index 5e025b0966..ce6b9899ec 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs @@ -404,7 +404,7 @@ namespace System.Diagnostics.Tracing public static Guid GetGuid(Type eventSourceType) { if (eventSourceType == null) - throw new ArgumentNullException("eventSourceType"); + throw new ArgumentNullException(nameof(eventSourceType)); Contract.EndContractBlock(); EventSourceAttribute attrib = (EventSourceAttribute)GetCustomAttributeHelper(eventSourceType, typeof(EventSourceAttribute)); @@ -429,7 +429,7 @@ namespace System.Diagnostics.Tracing if (name == null) { - throw new ArgumentException(Resources.GetResourceString("Argument_InvalidTypeName"), "eventSourceType"); + throw new ArgumentException(Resources.GetResourceString("Argument_InvalidTypeName"), nameof(eventSourceType)); } return GenerateGuidFromName(name.ToUpperInvariant()); // Make it case insensitive. } @@ -472,7 +472,7 @@ namespace System.Diagnostics.Tracing public static string GenerateManifest(Type eventSourceType, string assemblyPathToIncludeInManifest, EventManifestOptions flags) { if (eventSourceType == null) - throw new ArgumentNullException("eventSourceType"); + throw new ArgumentNullException(nameof(eventSourceType)); Contract.EndContractBlock(); byte[] manifestBytes = EventSource.CreateManifestAndDescriptors(eventSourceType, assemblyPathToIncludeInManifest, null, flags); @@ -511,12 +511,12 @@ namespace System.Diagnostics.Tracing public static void SendCommand(EventSource eventSource, EventCommand command, IDictionary<string, string> commandArguments) { if (eventSource == null) - throw new ArgumentNullException("eventSource"); + throw new ArgumentNullException(nameof(eventSource)); // User-defined EventCommands should not conflict with the reserved commands. if ((int)command <= (int)EventCommand.Update && (int)command != (int)EventCommand.SendManifest) { - throw new ArgumentException(Resources.GetResourceString("EventSource_InvalidCommand"), "command"); + throw new ArgumentException(Resources.GetResourceString("EventSource_InvalidCommand"), nameof(command)); } eventSource.SendCommand(null, 0, 0, command, true, EventLevel.LogAlways, EventKeywords.None, commandArguments); @@ -1451,7 +1451,7 @@ namespace System.Diagnostics.Tracing m_traits = traits; if (m_traits != null && m_traits.Length % 2 != 0) { - throw new ArgumentException(Resources.GetResourceString("TraitEven"), "traits"); + throw new ArgumentException(Resources.GetResourceString("TraitEven"), nameof(traits)); } if (eventSourceGuid == Guid.Empty) @@ -1543,7 +1543,7 @@ namespace System.Diagnostics.Tracing private static string GetName(Type eventSourceType, EventManifestOptions flags) { if (eventSourceType == null) - throw new ArgumentNullException("eventSourceType"); + throw new ArgumentNullException(nameof(eventSourceType)); Contract.EndContractBlock(); EventSourceAttribute attrib = (EventSourceAttribute)GetCustomAttributeHelper(eventSourceType, typeof(EventSourceAttribute), flags); @@ -3672,7 +3672,7 @@ namespace System.Diagnostics.Tracing if (eventData == null || eventData.Length <= eventAttribute.EventId) { EventMetadata[] newValues = new EventMetadata[Math.Max(eventData.Length + 16, eventAttribute.EventId + 1)]; - Array.Copy(eventData, newValues, eventData.Length); + Array.Copy(eventData, 0, newValues, 0, eventData.Length); eventData = newValues; } @@ -3711,7 +3711,7 @@ namespace System.Diagnostics.Tracing if (eventData.Length - idx > 2) // allow one wasted slot. { EventMetadata[] newValues = new EventMetadata[idx + 1]; - Array.Copy(eventData, newValues, newValues.Length); + Array.Copy(eventData, 0, newValues, 0, newValues.Length); eventData = newValues; } } @@ -3994,7 +3994,7 @@ namespace System.Diagnostics.Tracing EventSourceSettings.EtwSelfDescribingEventFormat; if ((settings & evtFormatMask) == evtFormatMask) { - throw new ArgumentException(Resources.GetResourceString("EventSource_InvalidEventFormat"), "settings"); + throw new ArgumentException(Resources.GetResourceString("EventSource_InvalidEventFormat"), nameof(settings)); } // If you did not explicitly ask for manifest, you get self-describing. @@ -4351,7 +4351,7 @@ namespace System.Diagnostics.Tracing { if (eventSource == null) { - throw new ArgumentNullException("eventSource"); + throw new ArgumentNullException(nameof(eventSource)); } Contract.EndContractBlock(); @@ -4366,7 +4366,7 @@ namespace System.Diagnostics.Tracing { if (eventSource == null) { - throw new ArgumentNullException("eventSource"); + throw new ArgumentNullException(nameof(eventSource)); } Contract.EndContractBlock(); @@ -6000,7 +6000,7 @@ namespace System.Diagnostics.Tracing internal bool m_activityFilteringEnabled; // does THIS EventSource have activity filtering turned on for this listener? #endif // FEATURE_ACTIVITYSAMPLING - // Only guarenteed to exist after a InsureInit() + // Only guaranteed to exist after a InsureInit() internal EventDispatcher m_Next; // These form a linked list in code:EventSource.m_Dispatchers // Of all listeners for that eventSource. } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs index b8512bf906..00bd0b7caa 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs @@ -178,12 +178,12 @@ namespace System.Diagnostics.Tracing else if ((type.IsArray || type.IsPointer) && type.GetElementType() == typeof(byte)) return "win:Binary"; - ManifestError(Environment.GetResourceString("EventSource_UnsupportedEventTypeInManifest", type.Name), true); + ManifestError(Resources.GetResourceString("EventSource_UnsupportedEventTypeInManifest", type.Name), true); return string.Empty; } } } - + internal partial class EventProvider { [System.Security.SecurityCritical] |