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

Conversation

nikolajlauridsen
Copy link
Contributor

We'll explode if you try to install while there are comments in the appsettings.json

To fix this I've added some JsonDocumentOptions to skip comments, unfortunately, this means that any comments will be removed, because they're not read in when manipulating the JSON.

The reason for this is that since .NET Core 3.1 the JsonDocument and JsonSerializer do not support allowing comments, you'll just get an error if you try.

The underlying reason is that the JSON spec does not support comments, and the dotnet team seems to feel very strongly about adhering to the spec, which is fair enough but means we cannot support having the comments in the app settings JSON document. For more information see the following discussion dotnet/runtime#35251 (Warning: It's a very heated debate).

Testing

Try installing while there is a comment in the appsettings.json it should no longer explode, but the comment will disappear.

@nikolajlauridsen nikolajlauridsen added the project/bellissima AKA "the new backoffice" label May 14, 2024
@Zeegaan
Copy link
Member

Zeegaan commented May 14, 2024

LGTM 🚀

@Zeegaan Zeegaan merged commit 7f654a1 into v14/dev May 14, 2024
16 checks passed
@Zeegaan Zeegaan deleted the v14/feature/commens-in-appsettings-shouldnt-explode branch May 14, 2024 12:12
@Zeegaan Zeegaan removed the project/bellissima AKA "the new backoffice" label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants