Hello,
With .Net 4.5 we get a NullReferenceException when we bind to a property with the name Item.
I found following explanation for that problem.
Problem is found in following method.
"PresentationFramework.dll!MS.Internal.Data.PropertyPathWorker.DetermineWhetherDBNullIsValid(object item)"
...
"Code assumes that if columnName
is "Item"
, then property is indexer and tries to access its first argument viaargs[0]
and this is where NullReferenceException
occurs becauseargs
is null
since property is not indexer. It just happens to be named"Item"
.
.NET implementers should have used
PropertyInfo.GetIndexParameters() on info
and if returned array doesn't contain zero elements, make certain assumption that property is indexer. Or use
Binding.IndexerName for checking (Binding.IndexerName has value "Item[]"
)."
Source:
http://stackoverflow.com/questions/17733338/combobox-selecteditem-databinding-nullreference-exception/17820919#17820919
Obviously it is a bug in the framework.
Will Microsoft fix this bug in the future?