Skip to content

Assert.Throws<ArgumentException>(paramName:null, Action) throws ArgumentNullException #2396

Closed
@ericstj

Description

@ericstj

Regression introduced here:
xunit/assert.xunit@726e482#diff-829bc159adac0f20073a5979fa4b4db6d7586a249058328199b486cf26b01070R189

Observed in xUnit 2.4.2-pre.13

For better or worse, we have framework code that doesn't specify a parameter name for some ArgumentExceptions. EG: https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/libraries/System.Drawing.Common/tests/FontFamilyTests.cs#L63-L64

Specifying null for parameterName used to work for testing this scenario but now it throws in the Assert library. Can we bring back the old behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Assertion libraryxunit.v3.assertBugA fault in an existing featurehelp wantedA community-provided PR would be welcomed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions