diff options
Diffstat (limited to 'src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging')
12 files changed, 27 insertions, 38 deletions
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs index d0d687e8d8..079d7f480b 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs @@ -22,7 +22,6 @@ namespace System.Diagnostics.Tracing /// EventWrite. The instance must be Disabled before the arrays referenced /// by the pointers are freed or unpinned. /// </summary> - [SecurityCritical] internal unsafe struct DataCollector { [ThreadStatic] diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventPayload.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventPayload.cs index be97447301..5967ad6ab5 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventPayload.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventPayload.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Collections; +using System.Diagnostics; #if !ES_BUILD_AGAINST_DOTNET_V35 using Contract = System.Diagnostics.Contracts.Contract; @@ -26,7 +27,7 @@ namespace System.Diagnostics.Tracing { internal EventPayload(List<string> payloadNames, List<object> payloadValues) { - Contract.Assert(payloadNames.Count == payloadValues.Count); + Debug.Assert(payloadNames.Count == payloadValues.Count); m_names = payloadNames; m_values = payloadValues; @@ -40,7 +41,7 @@ namespace System.Diagnostics.Tracing get { if (key == null) - throw new System.ArgumentNullException("key"); + throw new System.ArgumentNullException(nameof(key)); int position = 0; foreach(var name in m_names) @@ -83,7 +84,7 @@ namespace System.Diagnostics.Tracing public bool ContainsKey(string key) { if (key == null) - throw new System.ArgumentNullException("key"); + throw new System.ArgumentNullException(nameof(key)); foreach (var item in m_names) { @@ -129,7 +130,7 @@ namespace System.Diagnostics.Tracing public bool TryGetValue(string key, out object value) { if (key == null) - throw new System.ArgumentNullException("key"); + throw new System.ArgumentNullException(nameof(key)); int position = 0; foreach (var name in m_names) diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs index fccfd48721..38c1767462 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs @@ -35,7 +35,7 @@ namespace System.Diagnostics.Tracing public EventSourceActivity(EventSource eventSource) { if (eventSource == null) - throw new ArgumentNullException("eventSource"); + throw new ArgumentNullException(nameof(eventSource)); Contract.EndContractBlock(); this.eventSource = eventSource; diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/FieldMetadata.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/FieldMetadata.cs index 45673f7ab5..309226b84d 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/FieldMetadata.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/FieldMetadata.cs @@ -108,7 +108,7 @@ namespace System.Diagnostics.Tracing if (name == null) { throw new ArgumentNullException( - "name", + nameof(name), "This usually means that the object passed to Write is of a type that" + " does not support being used as the top-level object in an event," + " e.g. a primitive or built-in type."); diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs index 0f34d95648..3ea781252f 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs @@ -1,5 +1,6 @@ using System.Reflection; using System.Runtime.InteropServices; +using System.Diagnostics; #if !ES_BUILD_AGAINST_DOTNET_V35 using Contract = System.Diagnostics.Contracts.Contract; @@ -132,7 +133,7 @@ namespace System.Diagnostics.Tracing { get { - Contract.Assert(_scalarLength == 0, "This ReflectedValue refers to an unboxed value type, not a reference type or boxed value type."); + Debug.Assert(_scalarLength == 0, "This ReflectedValue refers to an unboxed value type, not a reference type or boxed value type."); return _reference; } } @@ -141,7 +142,7 @@ namespace System.Diagnostics.Tracing { get { - Contract.Assert(_scalarLength > 0, "This ReflectedValue refers to a reference type or boxed value type, not an unboxed value type"); + Debug.Assert(_scalarLength > 0, "This ReflectedValue refers to a reference type or boxed value type, not an unboxed value type"); return _scalar; } } @@ -150,7 +151,7 @@ namespace System.Diagnostics.Tracing { get { - Contract.Assert(_scalarLength > 0, "This ReflectedValue refers to a reference type or boxed value type, not an unboxed value type"); + Debug.Assert(_scalarLength > 0, "This ReflectedValue refers to a reference type or boxed value type, not an unboxed value type"); return _scalarLength; } } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs index e51aff0380..901a0ed1a2 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Reflection; +using System.Diagnostics; #if !ES_BUILD_AGAINST_DOTNET_V35 using Contract = System.Diagnostics.Contracts.Contract; @@ -269,7 +270,7 @@ namespace System.Diagnostics.Tracing : base(type) { var typeArgs = type.GenericTypeArguments; - Contract.Assert(typeArgs.Length == 1); + Debug.Assert(typeArgs.Length == 1); this.valueInfo = TraceLoggingTypeInfo.GetInstance(typeArgs[0], recursionCheck); this.hasValueGetter = PropertyValue.GetPropertyGetter(type.GetTypeInfo().GetDeclaredProperty("HasValue")); this.valueGetter = PropertyValue.GetPropertyGetter(type.GetTypeInfo().GetDeclaredProperty("Value")); diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs index fa0f79f58f..516c8ba19a 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs @@ -175,7 +175,7 @@ namespace System.Diagnostics.Tracing { if (name != null && 0 <= name.IndexOf('\0')) { - throw new ArgumentOutOfRangeException("name"); + throw new ArgumentOutOfRangeException(nameof(name)); } } diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs index 4b6e633487..04a047fb35 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs @@ -21,7 +21,6 @@ namespace System.Diagnostics.Tracing /// full-trust code, this abstraction is unnecessary (though it probably /// doesn't hurt anything). /// </summary> - [SecuritySafeCritical] internal unsafe class TraceLoggingDataCollector { internal static readonly TraceLoggingDataCollector Instance = new TraceLoggingDataCollector(); diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs index 963c492419..07a56751ea 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs @@ -100,7 +100,7 @@ namespace System.Diagnostics.Tracing { if (eventSourceName == null) { - throw new ArgumentNullException("eventSourceName"); + throw new ArgumentNullException(nameof(eventSourceName)); } Contract.EndContractBlock(); } @@ -110,12 +110,11 @@ namespace System.Diagnostics.Tracing /// (Native API: EventWriteTransfer) /// </summary> /// <param name="eventName">The name of the event. Must not be null.</param> - [SecuritySafeCritical] public unsafe void Write(string eventName) { if (eventName == null) { - throw new ArgumentNullException("eventName"); + throw new ArgumentNullException(nameof(eventName)); } Contract.EndContractBlock(); @@ -138,12 +137,11 @@ namespace System.Diagnostics.Tracing /// Options for the event, such as the level, keywords, and opcode. Unset /// options will be set to default values. /// </param> - [SecuritySafeCritical] public unsafe void Write(string eventName, EventSourceOptions options) { if (eventName == null) { - throw new ArgumentNullException("eventName"); + throw new ArgumentNullException(nameof(eventName)); } Contract.EndContractBlock(); @@ -175,7 +173,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// </param> - [SecuritySafeCritical] public unsafe void Write<T>( string eventName, T data) @@ -212,7 +209,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// </param> - [SecuritySafeCritical] public unsafe void Write<T>( string eventName, EventSourceOptions options, @@ -251,7 +247,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// </param> - [SecuritySafeCritical] public unsafe void Write<T>( string eventName, ref EventSourceOptions options, @@ -297,7 +292,6 @@ namespace System.Diagnostics.Tracing /// public instance properties of data will be written recursively to /// create the fields of the event. /// </param> - [SecuritySafeCritical] public unsafe void Write<T>( string eventName, ref EventSourceOptions options, @@ -354,7 +348,6 @@ namespace System.Diagnostics.Tracing /// the values must match the number and types of the fields described by the /// eventTypes parameter. /// </param> - [SecuritySafeCritical] private unsafe void WriteMultiMerge( string eventName, ref EventSourceOptions options, @@ -415,7 +408,6 @@ namespace System.Diagnostics.Tracing /// the values must match the number and types of the fields described by the /// eventTypes parameter. /// </param> - [SecuritySafeCritical] private unsafe void WriteMultiMergeInner( string eventName, ref EventSourceOptions options, @@ -526,7 +518,6 @@ namespace System.Diagnostics.Tracing /// The number and types of the values must match the number and types of the /// fields described by the eventTypes parameter. /// </param> - [SecuritySafeCritical] internal unsafe void WriteMultiMerge( string eventName, ref EventSourceOptions options, @@ -604,7 +595,6 @@ namespace System.Diagnostics.Tracing #endif // FEATURE_MANAGED_ETW } - [SecuritySafeCritical] private unsafe void WriteImpl( string eventName, ref EventSourceOptions options, @@ -721,7 +711,6 @@ namespace System.Diagnostics.Tracing } } - [SecurityCritical] private unsafe void WriteToAllListeners(string eventName, ref EventDescriptor eventDescriptor, EventTags tags, Guid* pActivityId, EventPayload payload) { EventWrittenEventArgs eventCallbackArgs = new EventWrittenEventArgs(this); @@ -750,7 +739,6 @@ namespace System.Diagnostics.Tracing System.Runtime.ConstrainedExecution.Consistency.WillNotCorruptState, System.Runtime.ConstrainedExecution.Cer.Success)] #endif - [SecurityCritical] [NonEvent] private unsafe void WriteCleanup(GCHandle* pPins, int cPins) { diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTypes.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTypes.cs index 4e33e58a82..c2239671bb 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTypes.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTypes.cs @@ -94,7 +94,7 @@ namespace System.Diagnostics.Tracing { if (name == null) { - throw new ArgumentNullException("name"); + throw new ArgumentNullException(nameof(name)); } Contract.EndContractBlock(); @@ -132,7 +132,7 @@ namespace System.Diagnostics.Tracing { if (defaultName == null) { - throw new ArgumentNullException("defaultName"); + throw new ArgumentNullException(nameof(defaultName)); } Contract.EndContractBlock(); @@ -212,7 +212,7 @@ namespace System.Diagnostics.Tracing { if (paramInfos == null) { - throw new ArgumentNullException("paramInfos"); + throw new ArgumentNullException(nameof(paramInfos)); } Contract.EndContractBlock(); @@ -231,7 +231,7 @@ namespace System.Diagnostics.Tracing { if (types == null) { - throw new ArgumentNullException("types"); + throw new ArgumentNullException(nameof(types)); } Contract.EndContractBlock(); @@ -251,7 +251,7 @@ namespace System.Diagnostics.Tracing { if (typeInfos == null) { - throw new ArgumentNullException("typeInfos"); + throw new ArgumentNullException(nameof(typeInfos)); } Contract.EndContractBlock(); diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingMetadataCollector.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingMetadataCollector.cs index 0467ec43e5..41225c8626 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingMetadataCollector.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingMetadataCollector.cs @@ -156,7 +156,7 @@ namespace System.Diagnostics.Tracing size = 16; break; default: - throw new ArgumentOutOfRangeException("type"); + throw new ArgumentOutOfRangeException(nameof(type)); } this.impl.AddScalar(size); @@ -183,7 +183,7 @@ namespace System.Diagnostics.Tracing case TraceLoggingDataType.CountedUtf16String: break; default: - throw new ArgumentOutOfRangeException("type"); + throw new ArgumentOutOfRangeException(nameof(type)); } this.impl.AddScalar(2); @@ -227,7 +227,7 @@ namespace System.Diagnostics.Tracing case TraceLoggingDataType.Char8: break; default: - throw new ArgumentOutOfRangeException("type"); + throw new ArgumentOutOfRangeException(nameof(type)); } if (this.BeginningBufferedArray) diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs index 5815d12fb0..0cc17e02f3 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs @@ -36,7 +36,7 @@ namespace System.Diagnostics.Tracing { if (dataType == null) { - throw new ArgumentNullException("dataType"); + throw new ArgumentNullException(nameof(dataType)); } Contract.EndContractBlock(); @@ -56,7 +56,7 @@ namespace System.Diagnostics.Tracing { if (dataType == null) { - throw new ArgumentNullException("dataType"); + throw new ArgumentNullException(nameof(dataType)); } if (name == null) |