5

I have written a Winforms application which needs to save some settings for the next time the software runs. Easy I hear you say...

So, I decided to use something like this:

Properties.Settings.Default.mp4Directory = fbd.SelectedPath;
Properties.Settings.Default.Save();

All the settings are set to "User" not "Application"

And, it works perfectly on my development machine and test laptop - Happy Days!

So, I decide to publish it to the user.... The user then installs it on 2 different Windows 7 machines 32 bit and reports back that on ONE of the machines the settings are NOT being saved!!

I have read about 20 threads on Stack looking for a possible reason and I cannot find anything suggesting what could be causing this...

Can anyone suggest why this might be working on 3 out of 4 machines please?

I have asked the user if he can think of anything on the machine that might be causing this not to work but he is adamant that there is nothing "non-standard" about the machine...

Im stumped.

Thanks!

Trevor Daniel
  • 3,785
  • 12
  • 53
  • 89
  • 2
    You're *sure* it's not being saved? Where are you looking? – James Nov 20 '13 at 10:57
  • How do you determine that this is not being saved? – Lasse V. Karlsen Nov 20 '13 at 10:57
  • 1
    It is saved in a xml file in `C:\Users\\AppData` in a file called `user.config` as said [here](http://stackoverflow.com/questions/5789252/properties-settings-default-save-where-is-that-file). Can you check both machines? – Vitor Canova Nov 20 '13 at 10:58
  • 2
    @VitorCanova that's not *always* guaranteed to the case though, the location of the file depends on how the app is installed. See [Settings File Locations](http://msdn.microsoft.com/en-us/library/8eyb2ct1(v=vs.110).aspx). – James Nov 20 '13 at 11:01
  • @VitorCanova just checked my local machine and as you correctly say, the .xml file exists and has the values I expected in it – Trevor Daniel Nov 20 '13 at 11:02
  • @TrevorDaniel What about the machine where the user said it didn't save? – Vitor Canova Nov 20 '13 at 11:05
  • @James Good point. In my particularly case it is a [ClickOnce](http://msdn.microsoft.com/en-us/library/ms228995(v=vs.110).aspx) app. Trevor file could be in another folder but like he said it was found in his machine. Maybe is the same case. Thank's didn't know this peculiarity. – Vitor Canova Nov 20 '13 at 11:12
  • @VitorCanova I have asked the user to check the existence of the file.. Unfortunately, he's 8 hours behind me so I will have to wait for an answer :( – Trevor Daniel Nov 20 '13 at 12:09
  • @James the initial screen displays the previous users user name and it's always blank on the machine that won't work. But displays perfectly on the 3 machines that do work. – Trevor Daniel Nov 20 '13 at 12:11
  • @TrevorDaniel what are the differences between the machines that work and the ones that don't? i.e. OS, deployment mechanism, user permissions etc. – James Nov 20 '13 at 12:13
  • @james I am awaiting extra information from the user. Last time I asked he simply said, "there is nothing different, they are both Windows 7 32bit"... I have asked again and I am awaiting an answer. My gut feeling is that this has to be "machine specific"(?) – Trevor Daniel Nov 20 '13 at 12:34
  • @TrevorDaniel if the deployment of the app is identical then, most likely, it's something specific to that machine that's causing the issue (if there is indeed one). Did you check all the locations possible for the `user.config` file as per the link I added? – James Nov 20 '13 at 12:37

1 Answers1

3

This is working. Had to perform a Properties.Settings.Default.Upgrade() and then my saved settings get loaded.

or permission (ntfs permission) or Active directory permission or capacity of windows drive is full.

or there exist two user folder that you check another...

for example two or three folders there user.domain user.workgroupname user

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
saber tabatabaee yazdi
  • 4,404
  • 3
  • 42
  • 58