Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse System.ArgumentOutOfRangeException: Index was out of range. #3195

Closed
2 tasks done
fejdraus opened this issue Sep 30, 2024 · 6 comments
Closed
2 tasks done

Mouse System.ArgumentOutOfRangeException: Index was out of range. #3195

fejdraus opened this issue Sep 30, 2024 · 6 comments
Labels
question Further information is requested

Comments

@fejdraus
Copy link

fejdraus commented Sep 30, 2024

Rules

  • I made myself familiar with the Readme, FAQ and Troubleshooting.
  • I understand that, if insufficient information or no app logs will be provided, my issue will be closed without an answer.

What's wrong?

When switching the lighting mode for the mouse from "All" with "Battery State" selected to another mode (where "Battery Status" is not available), I get an error about accessing a non-existent index in the list at line LightingSetting? ls = mouse.LightingSettingForZone(visibleZone); in g-helper/app/AsusMouseSettings.cs.

I think the issue can be resolved by adding something like:

var selectedMode = 0;
if (index >= 0 && index < lightingModes.Count)
{
selectedMode = lightingModes[index];
}

How to reproduce the bug?

Open the mouse settings, select the "All" lighting mode, choose the "Battery State" type, then switch the mode to "Logo"

Logs

log.txt

Device and Model

Asus Rog Gladius III Willess, Asus Rog Strix G15

Additional information.

No response

Armoury Crate

Uninstalled

Asus Services

Peripherals

Version

0.191.0

OS

Windows 11 23H2

@seerge
Copy link
Owner

seerge commented Sep 30, 2024

@fejdraus hello, can you post full exception text here ?

And try this build
GHelper.zip

@seerge seerge added the question Further information is requested label Sep 30, 2024
@fejdraus
Copy link
Author

fejdraus commented Sep 30, 2024

Full stack trace:

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List`1.get_Item(Int32 index)
at GHelper.AsusMouseSettings.ComboBoxLightingMode_DropDownClosed(Object sender, EventArgs e) in D:\a\g-helper\g-helper\app\AsusMouseSettings.cs:line 329
at System.Windows.Forms.ComboBox.OnDropDownClosed(EventArgs e)
at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at GHelper.UI.RComboBox.WndProc(Message& m) in D:\a\g-helper\g-helper\app\UI\RComboBox.cs:line 203
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

This issue also reproduces on version 0.194.0.

seerge added a commit that referenced this issue Sep 30, 2024
@seerge
Copy link
Owner

seerge commented Sep 30, 2024

@fejdraus ok, then changes i did the linked build should fix this. Does it work fine for you ?

@fejdraus
Copy link
Author

@seerge I believe the changes you've made should resolve the issue. However, I haven't had the chance to test it yet. Ideally, it would be great if the default mode was applied when a specific mode is unavailable, as switching modes currently might result in an empty window.

@seerge
Copy link
Owner

seerge commented Sep 30, 2024

@fejdraus i'm not sure if this is a good idea, but try this build then
GHelper.zip

@seerge seerge closed this as completed Sep 30, 2024
seerge added a commit that referenced this issue Sep 30, 2024
@fejdraus
Copy link
Author

I have run your changes on my system, and everything works perfectly. Thank you.
I really like your application, and I appreciate that you continue to improve and develop it. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants