Skip to content

[WinForms] DataGridView-related API validate state and throw IOE #23529

Closed

Description

@RussKie

Selected DataGridView-related API validate object state and throw InvalidOperationException.

Selected API now validate object state and throw InvalidOperationException where previously a NullReferenceException could be thrown, if APIs were invoked without being constructing with a valid Owner.
Throwing InvalidOperationException is inline with the behaviours in .NET Runtime, and provides developers with a better debug experience clearly communicating which argument caused the exception.

Old behavior

The listed API would throw NullReferenceException if invoked with null input arguments.

New behavior

The listed API would throw InvalidOperationException if invoked without having a valid Owner property value (in addition to the existing exceptions).

Reason for change

Throwing InvalidOperationException is inline with the behaviours in .NET Runtime, and provides developers with a better debug experience clearly communicating which argument caused the exception.

Recommended action

  • Review and, if necessary, update the code to prevent constructing the affected types with Owner as null.

Category

  • Windows Forms

Version introduced: .NET 6.0 preview4

Affected APIs


Issue metadata

  • Issue type: breaking-change

Activity

  1. added
    🏁 Release: .NET 6
    on Mar 29, 2021
  2. added
    ⌚ Not Triaged
    breaking-change
    and removed
    ⌚ Not Triaged
    on Mar 29, 2021
  3. self-assigned this
    on Mar 29, 2021
  4. gewarren commented on Aug 16, 2021

    @gewarren
    Collaborator

    I'm going to close this issue now. If there are any more IOE changes for .NET 6, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 6breaking-changewinforms/subsvc

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions