belowaverage-org / SuperLauncher

🚀 Super Launcher is an admin launcher that persists in the system tray that can launch programs quickly; optionally, with administrator rights, as another user, or both.
https://belowaverage.org/software/superlauncher
GNU General Public License v3.0
96 stars 14 forks source link

Exception when re-launching as administrator. #8

Closed krisdb2009 closed 3 years ago

krisdb2009 commented 3 years ago
System.Configuration.ConfigurationErrorsException: Failed to save settings: An error occurred loading a configuration file: Could not find a part of the path 'C:\Users\Default\AppData\Local\Dylan_Bickerstaff\SuperLauncher.exe_Url_kvnbfvszmu1mtvgag5lolzhd1dffe1ff\1.1.1.0\bvecyywe.tmp'. (C:\Users\Default\AppData\Local\Dylan_Bickerstaff\SuperLauncher.exe_Url_kvnbfvszmu1mtvgag5lolzhd1dffe1ff\1.1.1.0\user.config) ---> System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Could not find a part of the path 'C:\Users\Default\AppData\Local\Dylan_Bickerstaff\SuperLauncher.exe_Url_kvnbfvszmu1mtvgag5lolzhd1dffe1ff\1.1.1.0\bvecyywe.tmp'. (C:\Users\Default\AppData\Local\Dylan_Bickerstaff\SuperLauncher.exe_Url_kvnbfvszmu1mtvgag5lolzhd1dffe1ff\1.1.1.0\user.config) ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Default\AppData\Local\Dylan_Bickerstaff\SuperLauncher.exe_Url_kvnbfvszmu1mtvgag5lolzhd1dffe1ff\1.1.1.0\bvecyywe.tmp'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at System.CodeDom.Compiler.TempFileCollection.EnsureTempNameCreated()
   at System.CodeDom.Compiler.TempFileCollection.AddExtension(String fileExtension, Boolean keepFile)
   at System.Configuration.Internal.WriteFileContext..ctor(String filename, String templateFilename)
   at System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext, Boolean assertPermissions)
   at System.Configuration.ClientSettingsStore.ClientSettingsConfigurationHost.OpenStreamForWrite(String streamName, String templateStreamName, Object& writeContext)
   at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
   --- End of inner exception stack trace ---
   at System.Configuration.MgmtConfigurationRecord.SaveAs(String filename, ConfigurationSaveMode saveMode, Boolean forceUpdateAll)
   at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
   --- End of inner exception stack trace ---
   at System.Configuration.ClientSettingsStore.WriteSettings(String sectionName, Boolean isRoaming, IDictionary newSettings)
   at System.Configuration.LocalFileSettingsProvider.SetPropertyValues(SettingsContext context, SettingsPropertyValueCollection values)
   at System.Configuration.SettingsBase.SaveCore()
   at System.Configuration.SettingsBase.Save()
   at System.Configuration.ApplicationSettingsBase.Save()
   at System.Windows.Forms.Form.OnFormClosing(FormClosingEventArgs e)
   at System.Windows.Forms.Form.WmClose(Message& m)
   at SuperLauncher.Launcher.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
prettyokay-software commented 3 years ago

I'm 95% sure it's a race condition between the old session saving and closing while the elevated session is attempting to read.

I'll post my fix for it soon-ish... It's been driving me crazy for months.

krisdb2009 commented 3 years ago

Same, it's super annoying. I can't get it to happen consistently either.

krisdb2009 commented 3 years ago

Good call on saving, starting the new process, then force quiting SuperLauncher to prevent the onclose event from trying to save agian while a new process is starting.