FlorianHockmann commented on PR #2738: URL: https://github.com/apache/tinkerpop/pull/2738#issuecomment-2314773893
Sorry for the late response @MavroudisMant and thanks for reporting this and offering a PR! However, I think that we shouldn't change this behavior. I tried to describe the situation in this JIRA issue: [TINKERPOP-3072](https://issues.apache.org/jira/browse/TINKERPOP-3072). The short version is that Gremlin also throws an exception in other languages like Java and Python if `next()` is called on a traversal that doesn't return any elements. Java throws a nice `NoSuchElementException` which is of course more descriptive than `System.InvalidOperationException: Enumeration already finished`, but it doesn't just silently return `null`. So, I think we can improve the situation in .NET by also throwing an exception with a clear error message to inform the user that there are no elements to return, but I don't think that we should return `null` here. `null` could also be the valid result of a traversal which is something different than having a traversal which doesn't return anything but the user still calls `Next()` on it and therefore expects a result. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
