Skip to content

Commit 34019ee

Browse files
committed
Cleaning up code
1 parent fece7d8 commit 34019ee

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

src/Microsoft.Extensions.Configuration.AzureAppConfiguration/AzureAppConfigurationProvider.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,6 @@ private async Task<Dictionary<string, string>> PrepareData(Dictionary<string, Co
630630
if (_requestTracingEnabled && _requestTracingOptions != null)
631631
{
632632
_requestTracingOptions.ResetAiConfigurationTracing();
633-
_requestTracingOptions.UsesSnapshotReference = false;
634633
}
635634

636635
foreach (KeyValuePair<string, ConfigurationSetting> kvp in data)
@@ -1028,15 +1027,13 @@ private async Task<Dictionary<KeyValueIdentifier, ConfigurationSetting>> LoadKey
10281027
{
10291028
existingSettings[resolvedSetting.Key] = resolvedSetting.Value;
10301029
}
1031-
1032-
// Only track the snapshot reference itself for refresh monitoring, since snapshots are immutable
1033-
watchedIndividualKvs[watchedKeyLabel] = new ConfigurationSetting(watchedKv.Key, watchedKv.Value, watchedKv.Label, watchedKv.ETag);
10341030
}
10351031
else
10361032
{
1037-
watchedIndividualKvs[watchedKeyLabel] = new ConfigurationSetting(watchedKv.Key, watchedKv.Value, watchedKv.Label, watchedKv.ETag);
10381033
existingSettings[watchedKey] = watchedKv;
10391034
}
1035+
1036+
watchedIndividualKvs[watchedKeyLabel] = new ConfigurationSetting(watchedKv.Key, watchedKv.Value, watchedKv.Label, watchedKv.ETag);
10401037
}
10411038
}
10421039

src/Microsoft.Extensions.Configuration.AzureAppConfiguration/Constants/ErrorMessages.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ internal class ErrorMessages
1313
public const string FeatureFlagInvalidFormat = "Invalid json format for feature flag. Key: '{0}'.";
1414
public const string InvalidKeyVaultReference = "Invalid Key Vault reference.";
1515
public const string SnapshotReferenceInvalidFormat = "Invalid snapshot reference format for key '{0}' (label: '{1}').";
16-
public const string SnapshotReferenceInvalidJsonProperty = "Invalid snapshot reference format for key '{0}' (label: '{1}'). The '" + JsonFields.SnapshotName + "' property must be a string value, but found {2}.";
17-
public const string SnapshotReferencePropertyMissing = "Invalid snapshot reference format for key '{0}' (label: '{1}'). The '" + JsonFields.SnapshotName + "' property is required.";
16+
public const string SnapshotReferenceInvalidJsonProperty = "Invalid snapshot reference format for key '{0}' (label: '{1}'). The '{2}' property must be a string value, but found {3}.";
17+
public const string SnapshotReferencePropertyMissing = "Invalid snapshot reference format for key '{0}' (label: '{1}'). The '{2}' property is required.";
1818
public const string SnapshotInvalidComposition = "{0} for the selected snapshot with name '{1}' must be 'key', found '{2}'.";
1919
}
2020
}

src/Microsoft.Extensions.Configuration.AzureAppConfiguration/SnapshotReference/SnapshotReferenceParser.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,23 @@ public static SnapshotReference Parse(ConfigurationSetting setting)
5151
{
5252
if (reader.Read() && reader.TokenType == JsonTokenType.String)
5353
{
54-
if (string.IsNullOrWhiteSpace(reader.GetString()))
54+
string snapshotName = reader.GetString();
55+
if (string.IsNullOrWhiteSpace(snapshotName))
5556
{
5657
throw new FormatException(string.Format(ErrorMessages.SnapshotReferenceInvalidFormat, setting.Key, setting.Label));
5758
}
5859

59-
return new SnapshotReference { SnapshotName = reader.GetString() };
60+
return new SnapshotReference { SnapshotName = snapshotName };
6061
}
6162

62-
throw new FormatException(string.Format(ErrorMessages.SnapshotReferenceInvalidJsonProperty, setting.Key, setting.Label, reader.TokenType));
63+
throw new FormatException(string.Format(ErrorMessages.SnapshotReferenceInvalidJsonProperty, setting.Key, setting.Label, JsonFields.SnapshotName, reader.TokenType));
6364
}
6465

6566
// Skip unknown properties
6667
reader.Skip();
6768
}
6869

69-
throw new FormatException(string.Format(ErrorMessages.SnapshotReferencePropertyMissing, setting.Key, setting.Label));
70+
throw new FormatException(string.Format(ErrorMessages.SnapshotReferencePropertyMissing, setting.Key, setting.Label, JsonFields.SnapshotName));
7071
}
7172
catch (JsonException jsonEx)
7273
{

0 commit comments

Comments
 (0)