In the C# code below, R# 5.1 and R# 6.0 both report a possible NullReferenceException for iter.Current. I don't understand how this can be.
According to MSDN, if iter.MoveNext() returns true "it moves the XPathNavigator object returned by the Current property to the next node in the selected node set", so I believe that the while loop can only be entered if iter.Current has been set.
Why then does R# report a possible NullReferenceException? Am I missing something or is this a bug?
XmlDocument doc = new XmlDocument();
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator iter = nav.Select("/valid/path");
XPathNodeIterator users = iter.Current.Select("");