Search Issue Tracker
Won't Fix
Votes
0
Found in
2017.3.1f1
Issue ID
1008619
Regression
No
IEnumerable<T>.Contains(null) returns False when Array has a null object in .NET 3.5
Steps to reproduce:
1. Open attached “ContainsNull.zip” Unity project
2. Open “Default” scene
3. Enter Play mode
4. Observe Console window
Expected results:
array.Contains(null) returns True
Actual results:
array.Contains(null) returns False even though a null object is present the array
Reproduced in: 2018.2.0a3, 2018.1.0b10, 2017.3.1p3, 2017.2.2f1, 2017.1.3p2, 2017.1.0a1
Note: works as expected in .NET 4.6
==========
Hello,
A workaround is to pass EqualityComparer<object>.Default when making the call to contains, i.e.
Console.WriteLine("array.Contains(null):" + array.Contains(null, EqualityComparer<object>.Default));
A change in behavior like this is risky to make to the legacy mono runtime. Given that there is a workaround and this works correctly in the new Mono I don't intend to make a fix to the legacy Mono.
Thanks,
Jonathan
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- No character limit when renaming Profile in Addressables Profile window, allowing excessively long names
- Blurry, low quality Active Profile icon used in Addressables Profiles window
- Project browser search area changes when maximing Game View
- Tree Asset Preview window is not updated after assigning a new Material
- Unapplied changes on the "MainPanel" GameObject in the "BlobShadow" of URP Samples
Add comment