TcNo-Acc-Switcher icon indicating copy to clipboard operation
TcNo-Acc-Switcher copied to clipboard

System.ArgumentException: Parameter is not valid.

Open twisted89 opened this issue 3 years ago • 4 comments

Describe the bug App crashes when launching (seems to be triggered by using a steam desktop shortcut)

To Reproduce Steps to reproduce the behavior:

  1. Double click a desktop steam switch shortcut

Expected behavior App should launch and switch steam accounts

Desktop (please complete the following information):

  • OS: Windows 11 21H2

Crash log:

Fatal error occurred! This crashlog will be automatically submitted next launch.

Error: System.ArgumentException: Parameter is not valid.
   at System.Drawing.Bitmap..ctor(Stream stream, Boolean useIcm)
   at System.Drawing.Bitmap..ctor(Stream stream)
   at System.Drawing.IconLib.BitmapEncoders.PNGEncoder.Read(Stream stream, Int32 resourceSize)
   at System.Drawing.IconLib.IconImage.Read(Stream stream, Int32 resourceSize)
   at System.Drawing.IconLib.EncodingFormats.IconFormat.Load(Stream stream)
   at System.Drawing.IconLib.MultiIcon.Load(Stream stream)
   at System.Drawing.IconLib.MultiIcon.Load(String fileName)
   at TcNo_Acc_Switcher_Globals.Globals.SaveImageFromIco(String ico, String output) in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Globals\Files.cs:line 460
   at TcNo_Acc_Switcher_Globals.Globals.SaveIconFromFile(String path, String output) in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Globals\Files.cs:line 406
   at TcNo_Acc_Switcher_Server.Data.Settings.Steam.LoadBasicCompat() in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Server\Data\Settings\Steam.cs:line 164
   at TcNo_Acc_Switcher_Server.Data.Settings.Steam.get_Instance() in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Server\Data\Settings\Steam.cs:line 67
   at TcNo_Acc_Switcher_Server.Data.Settings.Steam.get_ClosingMethod() in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Server\Data\Settings\Steam.cs:line 84
   at TcNo_Acc_Switcher_Server.Pages.Steam.SteamSwitcherFuncs.SwapSteamAccounts(String steamId, Int32 ePersonaState, String args) in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Server\Pages\Steam\SteamSwitcherFuncs.cs:line 401
   at TcNo_Acc_Switcher_Client.App.CliSwitch(String[] args, Int32 i) in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Client\App.xaml.cs:line 453
   at TcNo_Acc_Switcher_Client.App.ConsoleMain(StartupEventArgs e) in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Client\App.xaml.cs:line 352
   at TcNo_Acc_Switcher_Client.App.OnStartup(StartupEventArgs e) in C:\Users\TCNO\Documents\GitHub\TcNo-Acc-Switcher\TcNo-Acc-Switcher-Client\App.xaml.cs:line 119
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at TcNo_Acc_Switcher_Client.App.Main()

twisted89 avatar Mar 14 '22 12:03 twisted89

Bug has been fixed, update has not been pushed just yet, but should be in a few hours. Duplicate of https://github.com/TcNobo/TcNo-Acc-Switcher/issues/177

TCNOco avatar Mar 16 '22 11:03 TCNOco

Still occurs in latest update. FYI my shortcuts don't contain "Steam" - "C:\Program Files\TcNo Account Switcher\TcNo-Acc-Switcher.exe" +s: "

twisted89 avatar Mar 22 '22 19:03 twisted89

The shortcut should be correct:

  • To open the Steam switcher in the TcNo Account Switcher, the shortcut points to: "C:\Program Files\TcNo Account Switcher\TcNo-Acc-Switcher.exe" steam
  • To switch accounts, use: "C:\Program Files\TcNo Account Switcher\TcNo-Acc-Switcher.exe" +s:76561............
  • To switch accounts for Steam to say Busy mode: "C:\Program Files\TcNo Account Switcher\TcNo-Acc-Switcher.exe" +s:76561...........:4

I can't get an error using these... I assume you have removed the steam ID from your shortcut in this post as nothing is after +s:. Removing it from my shortcuts and testing just to see relaunches steam. no crash.

TCNOco avatar Mar 23 '22 11:03 TCNOco

That being said is it the same error? If you delete the shortcut, remove the account from the TcNo Account Switcher and add it back, does it work? What about clearing the following folders?

  • %AppData%\TcNo Account Switcher\LoginCache\Steam
  • %AppData%\TcNo Account Switcher\wwwroot\img\profiles\steam

TCNOco avatar Mar 23 '22 11:03 TCNOco