[Mono-dev] Behaviour of System.Linq.Enumerable.DistinctIterator<T> on Mono and .NET

Jonathan Mitchell lists at mugginsoft.com
Wed Mar 21 23:11:17 UTC 2018


On Mono 5.4.1

The following Distinct() method calls succeeds on .Net but raises with a  Null ref exception on Mono macOS 10.13
.
var orders = items.SelectMany(e => e.Deductions).Select(e => e.Order).Distinct();
foreach (var order in orders) {
	… // order is Null here and raises
}


On Mono `order` is Null though `orders` is an instance of System.Linq.Enumerable.DistinctIterator<T>.
In the local vars browser `orders` IEnumerator is Null.

I know I am a bit behind the curve in using 5.4.1 but the Reference source for  System.Linq.Enumerable,cs doesn’t seem to have changed much.
I thought the use of the reference source would have nuked this sort of divergence?
Or maybe I am just being a bit stupid...

Thanks

Jonathan




More information about the Mono-devel-list mailing list