sirWest / AudioSwitch

Switch between default audio input or output + change volume
Apache License 2.0
1.09k stars 87 forks source link

Error after removing an audio device #19

Open tklevenz opened 9 years ago

tklevenz commented 9 years ago

I removed one of my devices, after I rebooted I got the following error:

System.ArgumentOutOfRangeException: InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index
   at System.Windows.Forms.ListView.SelectedListViewItemCollection.get_Item(Int32 index)
   at AudioSwitch.Forms.FormSwitcher.<SetTrayIcons>b__14(CDevice x)
   at System.Collections.Generic.List`1.Find(Predicate`1 match)
   at AudioSwitch.Forms.FormSwitcher.SetTrayIcons()
   at AudioSwitch.Forms.FormSwitcher..ctor()
   at AudioSwitch.Classes.Program.Main(String[] args)

Reinstalling audioswitch fixed the Problem.

possi commented 9 years ago

v2.1.1 on Windows 10 (Pro 64Bit, Clean Install):

I got the exact same issue and can replicate it:

Log Entry: 07.08.2015 18:03:12

System.ArgumentOutOfRangeException: InvalidArgument=Value mit dem Wert 0 ist für index ungültig.
Parametername: index
   bei System.Windows.Forms.ListView.SelectedListViewItemCollection.get_Item(Int32 index)
   bei AudioSwitch.Forms.FormSwitcher.<SetTrayIcons>b__14(CDevice x)
   bei System.Collections.Generic.List`1.Find(Predicate`1 match)
   bei AudioSwitch.Forms.FormSwitcher.SetTrayIcons()
   bei AudioSwitch.Forms.FormSwitcher..ctor()
   bei AudioSwitch.Classes.Program.Main(String[] args)
-------------------------------

When ever I hide the device from list what is the current default device and restart the application the error appears on start. Fixes by removing from Settings.xml or changing default device to a not-hidden-device via windows.

Addition: The Hotkey "NextPlaybackDevice" doesn't skip hidden devices (I think it did in previous versions?), that way you may acivate a hidden playback device (the tray icon doesn't change). When restarting windows or audioswitch, the error appears next time. (Temporary Solution: Disable Playback Device in Windows)