Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/6.0] Fix nullability bug in System.Diagnostics.TraceSource Switch #58102

Merged
merged 1 commit into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected override void OnValueChanged() { }
public abstract partial class Switch
{
protected Switch(string displayName, string? description) { }
protected Switch(string displayName, string? description, string? defaultSwitchValue) { }
protected Switch(string displayName, string? description, string defaultSwitchValue) { }
public System.Collections.Specialized.StringDictionary Attributes { get { throw null; } }
public string Description { get { throw null; } }
public string DisplayName { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public abstract class Switch
private volatile bool _initialized;
private bool _initializing;
private volatile string _switchValueString = string.Empty;
private readonly string? _defaultValue;
private readonly string _defaultValue;
private object? _initializedLock;

private static readonly List<WeakReference<Switch>> s_switches = new List<WeakReference<Switch>>();
Expand Down Expand Up @@ -53,7 +53,7 @@ protected Switch(string displayName, string? description) : this(displayName, de
{
}

protected Switch(string displayName, string? description, string? defaultSwitchValue)
protected Switch(string displayName, string? description, string defaultSwitchValue)
{
// displayName is used as a hashtable key, so it can never
// be null.
Expand Down Expand Up @@ -203,7 +203,7 @@ private bool InitializeWithStatus()
// called again, we don't want to get caught in an infinite loop.
_initializing = true;

_switchValueString = _defaultValue!;
_switchValueString = _defaultValue;
OnValueChanged();
_initialized = true;
_initializing = false;
Expand Down