Skip to content

[WinForms] API validate input parameters and throw ANE #17085

Closed

Description

@RussKie

Selected API validate input parameters and throw ArgumentNullException.

Selected API now validate input parameters and throw ArgumentNullException where previously a NullReferenceException could be thrown, if APIs were invoked with null input arguments.
Throwing ArgumentException 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 ArgumentNullException if invoked with null input arguments.

Reason for change

Throwing ArgumentNullException 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 passing null input arguments in the listed API.
  • If the code is handling NullReferenceException replace (or supplement) it with handling ArgumentNullException.

Category

  • Windows Forms

Version introduced: .NET 5.0 Preview 1

Affected APIs

Version introduced: .NET 5.0 Preview 2

Affected APIs

Version introduced: .NET 5.0 Preview 5

Affected APIs

Version introduced: .NET 5.0 Preview 6

Affected APIs

Version introduced: .NET 5.0 Preview 7

Affected APIs

Version introduced: .NET 5.0 Preview 8

Affected APIs

Version introduced: .NET 5.0 RC1

Affected APIs


Issue metadata

  • Issue type: breaking-change

Activity

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

    @RussKie
    Author
  5. gewarren commented on Feb 14, 2020

    @gewarren
    Collaborator

    @RussKie Shoot! I think the checklist will be easier since you don't have to edit the markdown.

  6. RussKie commented on Feb 14, 2020

    @RussKie
    Author
  7. RussKie commented on Apr 23, 2020

    @RussKie
    Author
  8. gewarren commented on Apr 23, 2020

    @gewarren
    Collaborator

    No, I'll reopen this one.

  9. added a commit that references this issue on Sep 9, 2020
  10. 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