I have a windows form application, which uses some user settings (Settings.settings)
One of those settings if of type bool and set to default of False.

In my form_load event I check that value, if it is true then a new form is started where user enters a password, and the application exits if the password is incorrect or the user closes the form, if it's correct the application starts.

I check the value like so public static bool hasPassword = Convert.ToBoolean(Settings.Default["PasswordProtected"]);
The application was working fine until I tried to start it from within VS via the start button in release mode, when it asked me something which I cannot remember, anyway I opted to stop debugging and ran the exe directly from the folder. All that worked fine too.

I went back to debug mode, and tried it through start again, it brought up my password form. That is odd because the setting remained False, and furthermore entering the correct password caused the app to exit, instead of continuing.

I've tried deleting everything in the release folder, to no avail. I tried a lot of things, and here's where it gets weird, at least to me. In the project properties under debug I unchecked the option for 'Enable the visual studio hosting process' and the app seems to work as expected, only presenting the password when the settings value is true. If I check that option again, It's back to acting unexpectedly.

I have not added any code, as I'm quite sure It's not a code issue.

Thank you for your patience reading.

Something else I remembered that I done which could be significant, was I deleted a setting (settings,settings) within the designer.

I've since deleted everything in the debug folder too, and rebuilt project. The problem persists.

I've tried deleting everything in the release folder, to no avail

Have you deleted also app.config file from your source code/project folder?

This article has been dead for over six months. Start a new discussion instead.