Skip to content

PropertyGrid: PropertyGridView.OnMouseWheel - IndexOutOfRangeException #14169

Closed

Description

@ulfemsoy

.NET version

.NET 9

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

Not sure.

Issue description

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnMouseWheel(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseWheel(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

Steps to reproduce

Not sure.

Activity

  1. added
    untriaged
    on Dec 24, 2025
  2. added
    area-controls-PropertyGrid
    on Dec 24, 2025
  3. Zheng-Li01 commented on Dec 25, 2025

    @Zheng-Li01
    Member

    @ulfemsoy could you please provide more details to help reproduce the issue, such as stable steps or sample project?

  4. ulfemsoy commented on Dec 25, 2025

    @ulfemsoy
    Author

    @Zheng-Li01:
    The issue was found in the error log. I'm not sure how to re-create the issue.
    The Exception is thrown on line 3193:

    CommitValue(values[index]);

    Cause:
    The code does not check if the array is empty (zero length).

    --

    The array (which could be empty) is returned from (line 1464):

    ///


    /// Returns the standard text values of this property.
    ///

    public virtual object[] GetPropertyValueList()
    {
    if (TypeConverter.GetStandardValues(this) is { } values)
    {
    object[] valueArray = new object[values.Count];
    values.CopyTo(valueArray, 0);
    return valueArray;
    }

      return []; // CAUSING THE EXCEPTION
    

    }

  5. removed
    untriaged
    on Jan 5, 2026
  6. self-assigned this
    on Jan 5, 2026
  7. Amy-Li03 commented on Sep 4, 2026

    @Amy-Li03
    Contributor

    Tested in the latest .NET 11 RC2 build: 11.0.100-rc.2.26453.107 + built private dls from the main branch of WinForms repo, it was fixed. No IndexOutOfRangeException throw for PropertyGridView.OnMouseWheel.

    Image
  8. added this to the 12.0-preview1 milestone on Sep 4, 2026
  9. locked and limited conversation to collaborators on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-controls-PropertyGrid

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions