Florian Hockmann created TINKERPOP-3072:
-------------------------------------------
Summary: Gremlin.Net Traversal enumeration error if element does
not exist on .NET 8
Key: TINKERPOP-3072
URL: https://issues.apache.org/jira/browse/TINKERPOP-3072
Project: TinkerPop
Issue Type: Bug
Components: dotnet
Affects Versions: 3.7.2, 3.6.7
Reporter: Florian Hockmann
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:
{code:java}
g.V().Has("Name", "doesnotexist").Next(); {code}
This will throw the following error:
{code:java}
System.InvalidOperationException: Enumeration already finished. {code}
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:
{code:java}
gremlin> g.V().has('name','doesnotexist').next()
java.util.NoSuchElementException{code}
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(){}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)