Skip to content

Conversation

@maxkoshevoi
Copy link

@maxkoshevoi maxkoshevoi commented Aug 21, 2024

Fixes #300

Notes:

  • As I understood KeyValueSelector can ether be initialized with key and label, or snapshot so I introduced two constructors to reflect that
  • I also found some potential places where NRE can occur. Marked them as comments in this PR

Comment on lines +241 to +246
Select(featureFlagFilter!, labelFilter!);

_multiKeyWatchers.AppendUnique(new KeyValueWatcher
{
Key = featureFlagFilter,
Label = labelFilter,
Key = featureFlagFilter!,
Label = labelFilter!,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here there's no check that featureFlagSelector.KeyFilter and featureFlagSelector.LabelFilter are not null. They might be since featureFlagSelector could be initialized with SnapshotName

}

Uri currentEndpoint = _configClientManager.GetEndpointForClient(clientEnumerator.Current);
Uri currentEndpoint = _configClientManager.GetEndpointForClient(clientEnumerator.Current)!;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IConfigurationClientManager.GetEndpointForClient can return null if it doesn't find the client, but everywhere it's used return value is never checked for null (here's an example)

case JsonValueKind.False:
case JsonValueKind.Null:
_data.Add(new KeyValuePair<string, string>(_currentPath, element.ToString()));
_data.Add(new KeyValuePair<string, string?>(_currentPath!, element.ToString()));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_currentPath can be null here if we never execute EnterContext or ExitContext


var configClient = _credential == null
? new ConfigurationClient(ConnectionStringUtils.Build(targetEndpoint, _id, _secret), _clientOptions)
? new ConfigurationClient(ConnectionStringUtils.Build(targetEndpoint, _id!, _secret!), _clientOptions)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ConfigurationClientManager is initialized using the constructor with endpoints, _id and _secret will be null here

@maxkoshevoi maxkoshevoi marked this pull request as ready for review August 21, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nullable annotations

1 participant