We've written a custom section handler for the smtp section (SmtpSection) and are populating it's values from a json file in Sectional mode. A fully-populated, but empty file looks like this:
{
"appSettings": {
},
"connectionStrings": {
},
"machineKey": {
},
"smtp":{
}
}
However if we omit the smtp section of this file the Json source throws an error in the GetCurrentDictionary() method because _currentSection will be set to "smtp" and there is no "smtp" key value populated in _allSettings.
A better approach is to check to see if _allSettings contains that key before requesting access to that value.
I'm submitting a basic PR to address this issue. Without this fix all of our json configuration files have to contain smtp sections, even if we are not specifying values in this area.
We've written a custom section handler for the smtp section (SmtpSection) and are populating it's values from a json file in Sectional mode. A fully-populated, but empty file looks like this:
However if we omit the smtp section of this file the Json source throws an error in the GetCurrentDictionary() method because _currentSection will be set to "smtp" and there is no "smtp" key value populated in _allSettings.
A better approach is to check to see if _allSettings contains that key before requesting access to that value.
I'm submitting a basic PR to address this issue. Without this fix all of our json configuration files have to contain smtp sections, even if we are not specifying values in this area.