Skip to content

PropertyGrid: PropertyGridView.DoubleClickRow - IndexOutOfRangeException #14170

Closed

Description

@ulfemsoy

.NET version

.NET 9

Did it work in .NET Framework?

Yes

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.DoubleClickRow(Int32 row, Boolean toggleExpand, Int32 type)
at System.Windows.Forms.PropertyGridInternal.GridEntry.OnMouseClick(Int32 x, Int32 y, Int32 count, MouseButtons button)
at System.Windows.Forms.PropertyGridInternal.PropertyGridView.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
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 1310:

    CommitValue(values[index]);

    Cause:
    The following code does not take into account that the array could be empty (line 1301):
    if (index >= (values.Length - 1)) { index = 0; } else { index++; }

    --

    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. Zheng-Li01 commented on Dec 26, 2025

    @Zheng-Li01
    Member

    @ulfemsoy thanks for your update. create the sample project based on your description with the help of Copilot but failed. attached the reproduce application, could you please have a check and try to modify it to help reproduce the issue.

    ExceptionRepo.zip

  6. self-assigned this
    on Jan 5, 2026
  7. removed
    untriaged
    on Jan 6, 2026
  8. KlausLoeffelmann commented on Mar 18, 2026

    @KlausLoeffelmann
    Member

    If this worked in NetFX, what regressed it?
    @Olina-Zhang, @LeafShi1 FYI.

  9. Olina-Zhang commented on Mar 18, 2026

    @Olina-Zhang
    Member

    @KlausLoeffelmann @LeafShi1 Verified this issue still repro for PropertyGridView.DoubleClickRow and PropertyGridView.OnMouseWheel in .NET framework 4.8.1/4,7. It's not a regression in .NET versions.

    default.NETframework_repro.mp4
  10. 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.DoubleClickRow.

    Image
  11. added this to the 12.0-preview1 milestone on Sep 4, 2026
  12. 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