Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-3072

Gremlin.Net Traversal enumeration error if element does not exist on .NET 8

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.6.7, 3.7.2
    • None
    • dotnet
    • None

    Description

      Similar to TINKERPOP-3029, one can unfortunately still get traversal enumeration errors on .NET 8 with Gremlin.Net if Next() is called when there is no element.

      Example:

      g.V().Has("Name", "doesnotexist").Next(); 

      This will throw the following error:

      System.InvalidOperationException: Enumeration already finished. 

      With .NET versions earlier than .NET 8, we simply got null back here instead of the exception.

      I am not sure what the correct behavior here is. The same traversal throws a NoSuchElementException with Gremlin-Java:

       gremlin> g.V().has('name','doesnotexist').next()
      java.util.NoSuchElementException

      I think Gremlin.Net should either throw a similar exception which clearly states the problem (instead of the InvalidOperationException which looks like a bug) or return null, but it should definitely do that consistently, irrespective of the version of .NET. If we decide on throwing an exception in this case, then users probably have to change their code to always check for element existence first via HasNext().

      Attachments

        Activity

          People

            Unassigned Unassigned
            Florian Hockmann Florian Hockmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: