In my user settings for the application, I have a StringDictionary
named "websites". A NullReferenceException with the message "Object reference not set to an instance of an object." when it reaches this line: Properties.Settings.Default.websites.Add(nameBox.Text, urlBox.Text);
, but I can't figure out why. The VS debugger shows that nameBox.Text and urlBox.Text are the right values.
Edit:
I've determined that it's null by default, so on Form.Load, I added
if (Properties.Settings.Default.websites == null) {
MessageBox.Show("property is null");
Properties.Settings.Default.websites = new StringDictionary();
}
but now the settings aren't saving.