Skip to content

[Breaking change]: ExceptionCollection would now throw 'ArgumentException` if input is not of Exception type. #33695

@dreddy-work

Description

@dreddy-work

Description

Similar to #33694, We are now enforcing a specific type when creating an ExceptionCollection. The type being passed must be of the exception type, otherwise an ArgumentException will be thrown.

Version

.NET 8 Preview 1

Previous behavior

Previously, the creation of an ExceptionCollection object did not check for the type passed in and could potentially delay failure until later in the process. No exceptions were thrown during the object creation.

New behavior

the creation of an ExceptionCollection object will throw an ArgumentException if the type passed in is of not exception type.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

Reason for change

Existing documentation clearly notes that type should be of type exception. Making exceptions consistent across codebase.

Recommended action

This change should not have a significant impact on most scenarios. However, if users were previously not handling exceptions will now need to make changes to handle the ArgumentException.

Feature area

Windows Forms

Affected APIs

Creation of ExceptionCollection object.

ExceptionCollection()


Associated WorkItem - 62394

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 8Work items for the .NET 8 release📌 seQUESTeredIdentifies that an issue has been imported into Quest.binary incompatibleExisting binaries may encounter a breaking change in behavior.breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions