Description
When the match parameter of ImmutableArray<T>.Builder.RemoveAll is null, it throws NullReferenceException or no exception instead of ArgumentNullException.
For reference, List<T>.RemoveAll throws ArgumentNullException under the same condition.
var list = new List<int>();
list.RemoveAll(match: null); // ArgumentNullException
Reproduction Steps
var builder = ImmutableArray.CreateBuilder<int>();
builder.RemoveAll(null); // no exception
var builder = ImmutableArray.CreateBuilder<int>();
builder.Add(1);
builder.RemoveAll(null); // NullReferenceException
Expected behavior
ArgumentNullException is thrown.
Actual behavior
- When
Count == 0: no exception.
- When
Count > 0: NullReferenceException is thrown.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
A fix has been submitted in #125920.
This fix is a potential Bucket 2 breaking change per the breaking change guidelines.
Description
When the match parameter of
ImmutableArray<T>.Builder.RemoveAllis null, it throwsNullReferenceExceptionor no exception instead ofArgumentNullException.For reference,
List<T>.RemoveAllthrows ArgumentNullException under the same condition.Reproduction Steps
Expected behavior
ArgumentNullExceptionis thrown.Actual behavior
Count == 0: no exception.Count > 0:NullReferenceExceptionis thrown.Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
A fix has been submitted in #125920.
This fix is a potential Bucket 2 breaking change per the breaking change guidelines.