I am building a C # .NET application (VS2010), but I have some problems saving settings (which work fine under 32-bit Windows XP) under 64-bit Windows 7.
I have a Settings.settings parameter in a solution with a parameter check parameter named res112text in, set as a type string in the user area, with an βInternalβ parameter as an access modifier parameter.
Then save command in
Properties.Settings.Default.res112text = "10002b"; try { Properties.Settings.Default.Save(); } catch (Exception e) { MessageBox.Show(e.GetType().ToString() + " for " + e.Message.ToString()); }
upon detection, an error type immediately appears:
System.InvalidOperationException
and for an exception message:
Method failed with unexpected error code 3
I pack the .dll.config file into the installer and fit perfectly into the program file directory.
Can anyone suggest what might be wrong?
Update: full error:
Error System.InvalidOperationException: Method failed with unexpected error code 3. at System.Security.AccessControl.NativeObjectSecurity.CreateInternal( ResourceType resourceType, Boolean isContainer, String name, SafeHandle handle, AccessControlSections includeSections, Boolean createByName, ExceptionFromErrorCode exceptionFromErrorCode, Object exceptionContext) at System.Security.AccessControl.FileSecurity..ctor(String fileName, AccessControlSections includeSections) ... at System.Configuration.SettingsBase.Save() at MyAddon.IEModule.ConfigSave()
Update. There seems to be no workaround when IE Protected Mode is enabled unless all users have manually disabled it.
Donna source share