I am adding a string to a string collection that is located in my program settings.
foreach (string path in prefs.Paths)
{
Properties.Settings.Default.Paths.Add(path); // <-- returns null if assembly is signed
}
This works without exceptions until I sign the assembly in Solution->Properties->Signing
I created a new strong name key file in that same tab with a password.
When the program is running after signing the assembly I receive this exception:
System.NullReferenceException: 'Object reference not set to an instance of an object.'
Program.Properties.Settings.Paths.get returned null.
I removed my 'foreach' loop in an attempt to check if that was the problem by replacing it with:
Properties.Settings.Default.Paths.Add("test string");
The code still works when the assembly is unsigned but throws an exception when it is signed.
I believe that I am obviously missing something that happens when signing assemblies. Please shed some light on why this exception is occurring. Thank you for your time.