Issues using `.json5` files for `appsettings.json`
I wanted support for trailing commas and comments in my
appsettings.json
, so I decided to go with JSON5.
But here's the weird thing.
I can add trailing commas and comments to appsettings.json
and everything works perfectly fine. So far so good, but Rider complains that you can't have them in a json file.
No biggie, Rider supports .json5
so I renamed the file to appsettings.json5
and changed
to
And... now I'm getting NRE on one of the segments of the config. Everything starts working again as soon as I rename it back to .json
. I tried to be sneaky and use .5.json
with a file association in Rider, but no cigar, also getting NREs.
9 Replies
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
Oh, cool, I can't reproduce it in a basic console project :KEKW:
Seems like the
json
file type is hardcoded somehow...?

Yeah
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
It needn't have guessed, I told it what files I want:
I think the issue was, somehow, the layer of indirection I had
The project was updated from before the single-file config days, and the configuration was using a builder
So
with
I moved this config directly to
Program.cs
now,
And everything seems to workUnknown User•2d ago
Message Not Public
Sign In & Join Server To View
Nah, it works just fine now