Skip to content

Commit

Permalink
Add nullable annotations to System.Diagnostics.Tracing ref (dotnet#38434
Browse files Browse the repository at this point in the history
)

* Add nullable annotations to System.Diagnostics.Tracing ref

* Address API Review feedback
  • Loading branch information
safern authored Jun 21, 2019
1 parent 32d256e commit 96fe425
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,37 @@ namespace System.Diagnostics.Tracing
{
public abstract partial class DiagnosticCounter : System.IDisposable
{
internal DiagnosticCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
public void AddMetadata(string key, string value) { }
public void Dispose() { }
internal DiagnosticCounter() { }
public string DisplayName { get { throw null; } set { } }
public string DisplayUnits { get { throw null; } set { } }
public string Name { get { throw null; } }
public System.Diagnostics.Tracing.EventSource EventSource { get { throw null; } }
public string Name { get { throw null; } }
public void AddMetadata(string key, string? value) { }
public void Dispose() { }
}
public partial class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, Func<double> metricProvider) : base(name, eventSource) { }
public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, System.Func<double> metricProvider) { }
public override string ToString() { throw null; }
}
public partial class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingEventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { }
public IncrementingEventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
public System.TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
public void Increment(double increment = 1) { }
public TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
public override string ToString() { throw null; }
}
public partial class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingPollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, Func<double> totalValueProvider) : base(name, eventSource) { }
public TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
}
public IncrementingPollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, System.Func<double> totalValueProvider) { }
public System.TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
public override string ToString() { throw null; }
}
public partial class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) : base(name, eventSource) { }
public void WriteMetric(float value) { }
public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
public override string ToString() { throw null; }
public void WriteMetric(double value) { }
public void WriteMetric(float value) { }
}
}
79 changes: 39 additions & 40 deletions src/System.Diagnostics.Tracing/ref/System.Diagnostics.Tracing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public EventAttribute(int eventId) { }
public int EventId { get { throw null; } }
public System.Diagnostics.Tracing.EventKeywords Keywords { get { throw null; } set { } }
public System.Diagnostics.Tracing.EventLevel Level { get { throw null; } set { } }
public string Message { get { throw null; } set { } }
public string? Message { get { throw null; } set { } }
public System.Diagnostics.Tracing.EventOpcode Opcode { get { throw null; } set { } }
public System.Diagnostics.Tracing.EventTags Tags { get { throw null; } set { } }
public System.Diagnostics.Tracing.EventTask Task { get { throw null; } set { } }
Expand All @@ -48,17 +48,16 @@ public enum EventCommand
public partial class EventCommandEventArgs : System.EventArgs
{
internal EventCommandEventArgs() { }
public System.Collections.Generic.IDictionary<string, string> Arguments { get { throw null; } }
public System.Collections.Generic.IDictionary<string, string?>? Arguments { get { throw null; } }
public System.Diagnostics.Tracing.EventCommand Command { get { throw null; } }
public bool DisableEvent(int eventId) { throw null; }
public bool EnableEvent(int eventId) { throw null; }
}

[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Struct, Inherited=false)]
public partial class EventDataAttribute : System.Attribute
{
public EventDataAttribute() { }
public string Name { get { throw null; } set { } }
public string? Name { get { throw null; } set { } }
}
[System.AttributeUsageAttribute(System.AttributeTargets.Property)]
public partial class EventFieldAttribute : System.Attribute
Expand Down Expand Up @@ -119,7 +118,7 @@ public void DisableEvents(System.Diagnostics.Tracing.EventSource eventSource) {
public virtual void Dispose() { }
public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level) { }
public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords matchAnyKeyword) { }
public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords matchAnyKeyword, System.Collections.Generic.IDictionary<string, string> arguments) { }
public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords matchAnyKeyword, System.Collections.Generic.IDictionary<string, string?>? arguments) { }
protected static int EventSourceIndex(System.Diagnostics.Tracing.EventSource eventSource) { throw null; }
protected internal virtual void OnEventSourceCreated(System.Diagnostics.Tracing.EventSource eventSource) { }
protected internal virtual void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { }
Expand Down Expand Up @@ -152,11 +151,11 @@ public partial class EventSource : System.IDisposable
protected EventSource() { }
protected EventSource(bool throwOnEventWriteErrors) { }
protected EventSource(System.Diagnostics.Tracing.EventSourceSettings settings) { }
protected EventSource(System.Diagnostics.Tracing.EventSourceSettings settings, params string[] traits) { }
protected EventSource(System.Diagnostics.Tracing.EventSourceSettings settings, params string[]? traits) { }
public EventSource(string eventSourceName) { }
public EventSource(string eventSourceName, System.Diagnostics.Tracing.EventSourceSettings config) { }
public EventSource(string eventSourceName, System.Diagnostics.Tracing.EventSourceSettings config, params string[] traits) { }
public System.Exception ConstructionException { get { throw null; } }
public EventSource(string eventSourceName, System.Diagnostics.Tracing.EventSourceSettings config, params string[]? traits) { }
public System.Exception? ConstructionException { get { throw null; } }
public static System.Guid CurrentThreadActivityId { get { throw null; } }
public System.Guid Guid { get { throw null; } }
public string Name { get { throw null; } }
Expand All @@ -165,49 +164,49 @@ public event System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArg
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~EventSource() { }
public static string GenerateManifest(System.Type eventSourceType, string assemblyPathToIncludeInManifest) { throw null; }
public static string GenerateManifest(System.Type eventSourceType, string assemblyPathToIncludeInManifest, System.Diagnostics.Tracing.EventManifestOptions flags) { throw null; }
public static string? GenerateManifest(System.Type eventSourceType, string? assemblyPathToIncludeInManifest) { throw null; }
public static string? GenerateManifest(System.Type eventSourceType, string? assemblyPathToIncludeInManifest, System.Diagnostics.Tracing.EventManifestOptions flags) { throw null; }
public static System.Guid GetGuid(System.Type eventSourceType) { throw null; }
public static string GetName(System.Type eventSourceType) { throw null; }
public static System.Collections.Generic.IEnumerable<System.Diagnostics.Tracing.EventSource> GetSources() { throw null; }
public string GetTrait(string key) { throw null; }
public string? GetTrait(string key) { throw null; }
public bool IsEnabled() { throw null; }
public bool IsEnabled(System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords) { throw null; }
public bool IsEnabled(System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords, System.Diagnostics.Tracing.EventChannel channel) { throw null; }
protected virtual void OnEventCommand(System.Diagnostics.Tracing.EventCommandEventArgs command) { }
public static void SendCommand(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventCommand command, System.Collections.Generic.IDictionary<string, string> commandArguments) { }
public static void SendCommand(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventCommand command, System.Collections.Generic.IDictionary<string, string?>? commandArguments) { }
public static void SetCurrentThreadActivityId(System.Guid activityId) { }
public static void SetCurrentThreadActivityId(System.Guid activityId, out System.Guid oldActivityThatWillContinue) { throw null; }
public override string ToString() { throw null; }
public void Write(string eventName) { }
public void Write(string eventName, System.Diagnostics.Tracing.EventSourceOptions options) { }
public void Write(string? eventName) { }
public void Write(string? eventName, System.Diagnostics.Tracing.EventSourceOptions options) { }
protected void WriteEvent(int eventId) { }
protected void WriteEvent(int eventId, byte[] arg1) { }
protected void WriteEvent(int eventId, byte[]? arg1) { }
protected void WriteEvent(int eventId, int arg1) { }
protected void WriteEvent(int eventId, int arg1, int arg2) { }
protected void WriteEvent(int eventId, int arg1, int arg2, int arg3) { }
protected void WriteEvent(int eventId, int arg1, string arg2) { }
protected void WriteEvent(int eventId, int arg1, string? arg2) { }
protected void WriteEvent(int eventId, long arg1) { }
protected void WriteEvent(int eventId, long arg1, byte[] arg2) { }
protected void WriteEvent(int eventId, long arg1, byte[]? arg2) { }
protected void WriteEvent(int eventId, long arg1, long arg2) { }
protected void WriteEvent(int eventId, long arg1, long arg2, long arg3) { }
protected void WriteEvent(int eventId, long arg1, string arg2) { }
protected void WriteEvent(int eventId, params object[] args) { }
protected void WriteEvent(int eventId, string arg1) { }
protected void WriteEvent(int eventId, string arg1, int arg2) { }
protected void WriteEvent(int eventId, string arg1, int arg2, int arg3) { }
protected void WriteEvent(int eventId, string arg1, long arg2) { }
protected void WriteEvent(int eventId, string arg1, string arg2) { }
protected void WriteEvent(int eventId, string arg1, string arg2, string arg3) { }
protected void WriteEvent(int eventId, long arg1, string? arg2) { }
protected void WriteEvent(int eventId, params object?[] args) { }
protected void WriteEvent(int eventId, string? arg1) { }
protected void WriteEvent(int eventId, string? arg1, int arg2) { }
protected void WriteEvent(int eventId, string? arg1, int arg2, int arg3) { }
protected void WriteEvent(int eventId, string? arg1, long arg2) { }
protected void WriteEvent(int eventId, string? arg1, string? arg2) { }
protected void WriteEvent(int eventId, string? arg1, string? arg2, string? arg3) { }
[System.CLSCompliantAttribute(false)]
protected unsafe void WriteEventCore(int eventId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
protected void WriteEventWithRelatedActivityId(int eventId, System.Guid relatedActivityId, params object[] args) { }
protected void WriteEventWithRelatedActivityId(int eventId, System.Guid relatedActivityId, params object?[] args) { }
[System.CLSCompliantAttribute(false)]
protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, System.Guid* relatedActivityId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
public void Write<T>(string eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data) { }
public void Write<T>(string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref System.Guid activityId, ref System.Guid relatedActivityId, ref T data) { }
public void Write<T>(string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data) { }
public void Write<T>(string eventName, T data) { }
public void Write<T>(string? eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data) { }
public void Write<T>(string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref System.Guid activityId, ref System.Guid relatedActivityId, ref T data) { }
public void Write<T>(string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data) { }
public void Write<T>(string? eventName, T data) { }
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
protected internal partial struct EventData
{
Expand All @@ -220,21 +219,21 @@ protected internal partial struct EventData
public sealed partial class EventSourceAttribute : System.Attribute
{
public EventSourceAttribute() { }
public string Guid { get { throw null; } set { } }
public string LocalizationResources { get { throw null; } set { } }
public string Name { get { throw null; } set { } }
public string? Guid { get { throw null; } set { } }
public string? LocalizationResources { get { throw null; } set { } }
public string? Name { get { throw null; } set { } }
}
public partial class EventSourceCreatedEventArgs : System.EventArgs
{
public EventSourceCreatedEventArgs() { }
public System.Diagnostics.Tracing.EventSource EventSource { get { throw null; } }
public System.Diagnostics.Tracing.EventSource? EventSource { get { throw null; } }
}
public partial class EventSourceException : System.Exception
{
public EventSourceException() { }
protected EventSourceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public EventSourceException(string message) { }
public EventSourceException(string message, System.Exception innerException) { }
public EventSourceException(string? message) { }
public EventSourceException(string? message, System.Exception? innerException) { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct EventSourceOptions
Expand Down Expand Up @@ -269,15 +268,15 @@ internal EventWrittenEventArgs() { }
public System.Guid ActivityId { get { throw null; } }
public System.Diagnostics.Tracing.EventChannel Channel { get { throw null; } }
public int EventId { get { throw null; } }
public string EventName { get { throw null; } }
public string? EventName { get { throw null; } }
public System.Diagnostics.Tracing.EventSource EventSource { get { throw null; } }
public System.Diagnostics.Tracing.EventKeywords Keywords { get { throw null; } }
public System.Diagnostics.Tracing.EventLevel Level { get { throw null; } }
public string Message { get { throw null; } }
public string? Message { get { throw null; } }
public System.Diagnostics.Tracing.EventOpcode Opcode { get { throw null; } }
public long OSThreadId { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyCollection<object> Payload { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyCollection<string> PayloadNames { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyCollection<object?>? Payload { get { throw null; } }
public System.Collections.ObjectModel.ReadOnlyCollection<string>? PayloadNames { get { throw null; } }
public System.Guid RelatedActivityId { get { throw null; } }
public System.Diagnostics.Tracing.EventTags Tags { get { throw null; } }
public System.Diagnostics.Tracing.EventTask Task { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!-- CS0067: unused event, reference assembly does not care -->
<NoWarn>$(NoWarn);0067</NoWarn>
<Configurations>netcoreapp-Debug;netcoreapp-Release;uap-Debug;uap-Release</Configurations>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Diagnostics.Tracing.cs" />
Expand Down

0 comments on commit 96fe425

Please sign in to comment.