Akart
Akart

Reputation: 39

User Settings not loading, except in Debug mode

I have this nagging problem that has been driving me crazy for for days:

I have defined a couple of user setting via the designer. In my app I can read, update and save the values as expected - but only if I start the app in Debug mode with F5.

If I start my app without debugging, with Ctrl+F5 (or double-click the .exe file), I still have my settings, but they ALL are empty strings! If then I restart it with F5, all is back in order again!

It all looks as if with Ctrl+F5 the application is starting with an empty configuration file.

Has anyone had this problem?

Upvotes: 2

Views: 1251

Answers (1)

user3636971
user3636971

Reputation: 234

If Visual Studio hosting process is enabled, you have two different Settings.settings file - one for Release mode, another for Debug mode. You can change this behavior and "share" one settings file between these modes: go to Project properties -> Debug, and uncheck "Enable the Visual Studio hosting process".

For more information checkout this page: http://mrpfister.com/programming/the-dark-side-of-the-hosting-process-vshost-exe/

Upvotes: 5

Related Questions