public void NullKeys() { var john = new TestPerson(null); var people = new SynchronizedRangeObservableCollection <TestPerson>(); using (var query = people.ToActiveDictionary(p => new KeyValuePair <string, TestPerson>(p.Name, p))) { Assert.IsNull(query.OperationFault); people.Add(john); Assert.IsNotNull(query.OperationFault); john.Name = "John"; Assert.IsNull(query.OperationFault); john.Name = null; Assert.IsNotNull(query.OperationFault); people.Clear(); Assert.IsNull(query.OperationFault); } }