andyvorld / LGSTrayBattery

A tray app used to track battery levels of wireless Logitech mouse.
GNU General Public License v3.0
369 stars 30 forks source link

2.0.6 Crashing #37

Closed CZonin closed 2 years ago

CZonin commented 2 years ago

LGSTrayBattery crashes on hover. I've attached the crashlog.

Let me know if there's any other info I can provide!

Crashlog.log

paulkilla commented 2 years ago

I also get a crashlog.log but with the following System.OperationCanceledException: The operation was canceled. at Microsoft.Win32.SafeHandles.SafeFileHandle.OverlappedValueTaskSource.GetResult(Int16 token) at System.IO.Strategies.BufferedFileStreamStrategy.ReadFromNonSeekableAsync(Memory1 destination, CancellationToken cancellationToken) at Hid.Net.Windows.WindowsHidHandler.ReadReportAsync(CancellationToken cancellationToken) in //src/Hid.Net/Windows/WindowsHidHandler.cs:line 174 at Hid.Net.HidDevice.ReadReportAsync(CancellationToken cancellationToken) in //src/Hid.Net/HidDevice.cs:line 129 at Hid.Net.HidDevice.ReadAsync(CancellationToken cancellationToken) in /_/src/Hid.Net/HidDevice.cs:line 121 at LGSTrayHID.LogiDeviceHandler.WriteReadTimeoutAsync(Byte[] payload, UInt16 timeout) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 205 at LGSTrayHID.LogiDeviceHandler.GetProtocolAsync(Byte deviceId) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 224 at LGSTrayHID.LogiDeviceHandler.InitializeHIDPPAsync() in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 55 at LGSTrayHID.LogiDeviceHandler.CreateNewHandler(IDevice device) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 44 at LGSTrayHID.HIDDeviceManager._deviceListener_DeviceInitialized(Object sender, DeviceEventArgs e) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\HIDDeviceManager.cs:line 71 at System.Threading.Tasks.Task.<>c.b__128_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action1 callback, TState& state) at System.Threading.QueueUserWorkItemCallback.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()

IPGitUser commented 2 years ago

I am receiving a similar crashlog for both the standard and standalone versions. Crashlog.log

andyvorld commented 2 years ago

Try this release https://github.com/andyvorld/LGSTrayBattery/releases/tag/v2.0.7

As I had not realised that going from Net5 to Net6 introduced some breaking changes with async filestreams and in turn broke the under lying library used for communicating with the logitech devices.

paulkilla commented 2 years ago

With that release I get: System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.Collections.Generic.List1.Enumerator.MoveNext() at System.Linq.Enumerable.SelectManySingleSelectorIterator2.MoveNext() at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 source, Func2 predicate, Boolean& found) at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate) at LGSTrayGUI.MainWindowViewModel.UpdateSelectedDeviceOnLaunch(Object sender, PropertyChangedEventArgs e) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayGUI\MainWindowViewModel.cs:line 166 at LGSTrayGUI.MainWindowViewModel.<>cDisplayClass26_01.<RegisterDeviceManager>b__0(Object o, NotifyCollectionChangedEventArgs e) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayGUI\MainWindowViewModel.cs:line 145 at System.Collections.ObjectModel.ObservableCollection1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at System.Collections.ObjectModel.ObservableCollection1.InsertItem(Int32 index, T item) at System.Collections.ObjectModel.Collection1.Add(T item) at LGSTrayHID.HIDDeviceManager._deviceListener_DeviceInitialized(Object sender, DeviceEventArgs e) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\HIDDeviceManager.cs:line 86 at System.Threading.Tasks.Task.<>c.b__128_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state) at System.Threading.QueueUserWorkItemCallback.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()

Zenrage commented 2 years ago

I tried the new version, and I constantly get USB disconnections. I was playing a game and the rescan interval I think is disconnecting my Logi devices.

I use the G502 LS/ G915 Wireless

paulkilla commented 2 years ago

I should add I'm using:

wergio commented 2 years ago

crashing for me with 2.0.7. I've G533 headset, Mx Vertical, and other logitech periferals. would be usefull to kwno witch device is causing the crash. two different logs below:

System.NullReferenceException: Object reference not set to an instance of an object. at LGSTrayHID.LogiDeviceHandler.GetFeatureIdx(Byte deviceId, UInt16 featureId) at LGSTrayHID.LogiDeviceHandler.GetFeatureIdx(Byte deviceId, HIDFeatureID featureID) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 249 at LGSTrayHID.LogiDeviceHandler.InitializeHIDPPAsync() in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 70 at LGSTrayHID.LogiDeviceHandler.CreateNewHandler(IDevice device) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 44 at LGSTrayHID.HIDDeviceManager._deviceListener_DeviceInitialized(Object sender, DeviceEventArgs e) in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\HIDDeviceManager.cs:line 71 at System.Threading.Tasks.Task.<>c.b__128_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b__6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state) at System.Threading.QueueUserWorkItemCallback.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()

System.IO.IOException: An error occurred while attempting to write to the device ---> Device.Net.Exceptions.NotInitializedException: The device has not been initialized at Hid.Net.Windows.WindowsHidHandler.WriteReportAsync(Byte[] data, Byte reportId, CancellationToken cancellationToken) in //src/Hid.Net/Windows/WindowsHidHandler.cs:line 191 at Hid.Net.HidDevice.WriteReportAsync(Byte[] data, Byte reportId, CancellationToken cancellationToken) in //src/Hid.Net/HidDevice.cs:line 175 --- End of inner exception stack trace --- at Hid.Net.HidDevice.WriteReportAsync(Byte[] data, Byte reportId, CancellationToken cancellationToken) in /_/src/Hid.Net/HidDevice.cs:line 179 at LGSTrayHID.LogiDeviceHandler.UpdateBatteryStatus() in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 181 at LGSTrayHID.LogiDeviceHandler.UpdateBattery() in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\LogiDeviceHandler.cs:line 168 at LGSTrayHID.HIDDeviceManager.UpdateDevicesAsync() in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayHID\HIDDeviceManager.cs:line 55 at LGSTrayGUI.MainWindowViewModel.<>cDisplayClass26_0`1.<b2>d.MoveNext() in C:\Users\Andrew\source\repos\LGSTrayBattery\LGSTrayGUI\MainWindowViewModel.cs:line 153 --- End of stack trace from previous location --- at System.Threading.Tasks.Task.<>c.b128_1(Object state) at System.Threading.QueueUserWorkItemCallback.<>c.<.cctor>b6_0(QueueUserWorkItemCallback quwi) at System.Threading.ExecutionContext.RunForThreadPoolUnsafe[TState](ExecutionContext executionContext, Action`1 callback, TState& state) at System.Threading.QueueUserWorkItemCallback.Execute() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart() at System.Threading.Thread.StartCallback()

andyvorld commented 2 years ago

Try the new release https://github.com/andyvorld/LGSTrayBattery/releases/tag/v2.0.8,

I have semi-migrated away from HID.NET as the backend for the battery status.

wergio commented 2 years ago

thanks, now not crashing anymore!

correctly detected: Mx Vertical mouse K360 Keyboard K400 plus Keyboard

but NOT detected: G533 headset wireless

what can i do to make it work even with the headset?

andyvorld commented 2 years ago

Could you please redirect further comments to #40?