Επεξεργασία

Κοινή χρήση μέσω


ExceptionCollection ctor throws ArgumentException

The ExceptionCollection constructor now throws an ArgumentException if the elements in the input array are not of type Exception.

Version introduced

.NET 8 Preview 1

Previous behavior

Previously, the ExceptionCollection constructor did not check the type passed in, which could delay failure until later in the process. No exceptions were thrown during object creation.

New behavior

Starting in .NET 8, if the elements in the input array are not of type Exception, an ArgumentException is thrown.

Change category

This change is a behavioral change.

Reason for change

This change helps to make exception types consistent across the code base.

For most scenarios, this change should not have a significant impact. However, consider updating your code to handle ArgumentException at constructor call sites.

Affected APIs