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

V14: Add JsonDocumentOptions skipping comments in appsettings #16281

Merged
Merged
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 @@ -19,6 +19,7 @@ internal class JsonConfigManipulator : IConfigManipulator
private const string GlobalIdPath = $"{CmsObjectPath}:Global:Id";
private const string DisableRedirectUrlTrackingPath = $"{CmsObjectPath}:WebRouting:DisableRedirectUrlTracking";

private readonly JsonDocumentOptions _jsonDocumentOptions = new() { CommentHandling = JsonCommentHandling.Skip };
private readonly IConfiguration _configuration;
private readonly ILogger<JsonConfigManipulator> _logger;
private readonly SemaphoreSlim _lock = new(1, 1);
Expand Down Expand Up @@ -238,7 +239,7 @@ private async Task SaveJsonAsync(JsonConfigurationProvider? provider, JsonNode j
try
{
using var streamReader = new StreamReader(jsonFilePath);
return await JsonNode.ParseAsync(streamReader.BaseStream);
return await JsonNode.ParseAsync(streamReader.BaseStream, documentOptions: _jsonDocumentOptions);
}
catch (IOException exception)
{
Expand Down
Loading