-
Notifications
You must be signed in to change notification settings - Fork 203
System.NullReferenceException for invalid appsettings.json #476
Comments
Agreed 1000000%. The current exception doesn't give any useful info, it should be replaced with a more meaningful one. |
Just had this problem now. Really cryptic. This should be handled better, definitely. |
Looks much better now. Thanks @HaoK . |
It looks like we still throw a NullReferenceException (or just return null values) if Thoughts on fixing that @HaoK @divega ? The scenario is: With a JSON config file with |
@HaoK would |
Yeah that's why we added that feature to make it possible to log at least for situations like this.
|
This took me a while to track down...
As I was porting a project from dnx to dotnet I came across this issue.
I missed a closing curly brace "}" in the appsettings.json file. VS does warn if I had the file opening, however, I didn't think to look there until after walking the code.
The invalid json throws a Null Reference exception. I feel that there should be some json validation further upstream, maybe JsonConfigurationProvider.Load and throw an appropriate invalid Json exception there.
The text was updated successfully, but these errors were encountered: