Assert.Throws<ArgumentException>(paramName:null, Action) throws ArgumentNullException
Regression introduced here: https://github.com/xunit/assert.xunit/commit/726e48276895ecba39468990809664948113d876#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?
I'll add that we can workaround this by using Assert.Throws<ArgumentException>(Action) but we'd actually like to Assert a null parameter name, since it's clear that we didn't forget to test it. Today we'll use our own wrapper to do this, but I wanted to raise this breaking change of behavior.
This was probably just overly zealous on my part when I went through and introduced all the nullability. I probably assumed paramName was required in the exception.
This is breaking tests in https://github.com/dotnet/winforms/ after we've been forced to update to 2.4.2....
The workaround is to not use the Assert.Throws overload that checks the param name, and instead just use the normal Assert.Throws, take the return value (which is the exception) and do a separate Assert.Null.
Thank you for the guidance.
FYI, this will be fixed in 2.5.0.