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

NullReferenceException if keys(s) or section is missing #1

Open
TechnoTone opened this issue Sep 4, 2014 · 1 comment
Open

NullReferenceException if keys(s) or section is missing #1

TechnoTone opened this issue Sep 4, 2014 · 1 comment

Comments

@TechnoTone
Copy link
Contributor

I'm using the ConfigSettings class to read my AppConfig but found that if any keys (or the entire config section) was missing from the AppConfig then the Load would fail with an NullReferenceException.

Interestingly, depending upon which key was missing, some of the values would be loaded but others not. I suspect it's iterating the properties in alphabetical order so it depends where it gets to before the exception is thrown.

I would like it to ignore any missing values and to load the settings that are available, leaving any missing settings with their default: zero/empty/null/etc. Perhaps a future version could allow for the specification of default values in the IsSetting attribute?

I may fork the repo and make some changes. Would you accept a pull request if I did?

@JoakimM
Copy link
Owner

JoakimM commented Sep 4, 2014

I would gladly accept a pull request if you made one.
I will be fixing this issue today unless you beat me to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants