0

I am working with dot net standard (2.0) spec and found out some enums have repeating values,

for example: (this one is also in 4.7.2)

enum XPathResultType {
  Number = 0,
  Navigator = 1,
  String = 1,
  Boolean = 2,
  NodeSet = 3,
  Any = 5,
  Error = 6,
}
kobi7
  • 969
  • 1
  • 7
  • 15
  • This is interesting actually, TIL https://dotnetfiddle.net/SgizXG – Jebathon Sep 11 '18 at 19:14
  • Comments in the [reference source](https://referencesource.microsoft.com/#System.Data.SqlXml/System/Xml/Xsl/XsltOld/XsltCompileContext.cs,4e3a9b83a7794741,references) indicate that this is a bug: "Unfortunetely XPathResultType.String == XPathResultType.Navigator (This is wrong but cant be changed in Everett)" – Mike Zboray Sep 11 '18 at 19:32

1 Answers1

1

This is a previously known issue identified by Microsoft, as so:

The overlapping enum values is a known issue. The workaround is to never use the XPathResultType.Navigator value and to always use XPathResultType.NodeSet.

This is discussed is various articles, but the official MS one seems to have been removed from Connect.

This one talks about it: https://social.msdn.microsoft.com/Forums/en-US/00daba27-fe32-4b21-a2bc-4cee242b1bd5/xpathresulttypenavigator-and-xpathresulttypestring?forum=xmlandnetfx

Martin
  • 16,093
  • 1
  • 29
  • 48