locked
User Settings Initial Setup? RRS feed

  • Question

  • Is there anything you need to do to get the initial setup for User Settings when an application is run for the first time?

    I am having a problem with my application when it tries to access the user settings for the first time. I get the following error:

    Item has already been added. Key in dictionary: ''  Key being added: ''

    The stack reveals that it is when the following call is made:

    if (Properties.Settings.Default.PropertyValues.Count == 0)
                    {
                        Properties.Settings.Default.Reset(); //error occurs here
                    }

    When I run the application on my dev machine all works fine, but when I deploy it on a clean test machine it croaks. If I comment out the call to Reset(), I still get an error when I try to access any of the settings.

    I'm not entirely sure if this is a problem with the user settings, or some problem with my deployment project.

    I haven't been able to figure this one out or find answers through the usual channels -- any help would be greatly appreciated.

    Thanks, Peter





    Monday, September 25, 2006 6:05 PM

Answers

  • I finally solved this one. It was the obfuscator that was causing the problem, and that is why it was working on my dev machine and not in the deployed application.  Duh!

    Anywho, thanks for the comments.
    Monday, September 25, 2006 10:19 PM

All replies

  • What error are you getting on the test machine.  Both when you do and when you don't comment out the reset line?
    Monday, September 25, 2006 6:22 PM
  • If I comment those lines out, I get an error stating that the settings property was not found. Here is one:

    "The settings property 'MainWindowSize' was not found."

    The AppSettings.config has the values, but I counldn't find any settings in the <username>\Local Settings\Application Data\ folder, so that is what made me think it had to be setup the first time.

    The error with the Reset() line left in, gives me the error that I mentioned above.

    Monday, September 25, 2006 7:52 PM
  • I finally solved this one. It was the obfuscator that was causing the problem, and that is why it was working on my dev machine and not in the deployed application.  Duh!

    Anywho, thanks for the comments.
    Monday, September 25, 2006 10:19 PM