Skip to content

[WinForms] API validate input parameters and throw AOORE #18029

Closed

Description

@RussKie

Selected API validate input parameters and throw ArgumentOutOfRangeException.

Selected API now validate input parameters and throw ArgumentOutOfRangeException where previous behaviour could lead to faulty state.
Throwing ArgumentOutOfRangeException 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 could throw various exceptions (e.g. NullReferenceException, ArgumentException, ArgumentOutOfRangeException, etc.) if invoked with incorrect input arguments.

New behavior

The listed API would throw ArgumentOutOfRangeException if invoked with invalid input arguments.

Reason for change

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

Recommended action

  • Review and, if necessary, update the code to prevent passing input arguments of incorrect type to the listed API.
  • Handle ArgumentOutOfRangeException, if necessary.

Category

  • Windows Forms

Version introduced: .NET 5.0 Preview 5

Affected APIs

Version introduced: .NET 5.0 Preview 6

Affected APIs


Issue metadata

  • Issue type: breaking-change

Activity

  1. added
    ⌚ Not Triaged
    breaking-change
    on Apr 23, 2020
  2. self-assigned this
    on Apr 23, 2020
  3. added
    🏁 Release: .NET 5
    and removed
    ⌚ Not Triaged
    on Apr 23, 2020
  4. RussKie commented on Jun 4, 2020

    @RussKie
    ContributorAuthor

    Just FYI - this issue is missing WinForms label.

  5. RussKie commented on Oct 21, 2020

    @RussKie
    ContributorAuthor

    I'll have new ones opened for 6.0 😉
    Thank you for your help.

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

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 5breaking-changewinforms/subsvc

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions