Hi,

I could reproduce the problem also with our own tests. If they are executed 
with .NET 8, then some tests fail with the described exception. I have also 
already created an issue in JIRA for it because I also want to submit a PR to 
fix this soon:
https://issues.apache.org/jira/browse/TINKERPOP-3029

We should also update to .NET 8 soon, so we execute our tests with that: 
https://issues.apache.org/jira/browse/TINKERPOP-3030

This is definitely a severe issue that we should fix quickly. It really breaks 
Gremlin.Net on .NET 8 for a lot of traversals.
To be honest, I think when I originally implemented this enumeration logic, I 
simply looked at the corresponding logic in the Java driver and migrated it to 
C#. I wasn't aware that calling Current without calling MoveNext() first was 
already undefined behavior. It returned null in that case which was easy to 
work with.

Regards,
Florian

-----Ursprüngliche Nachricht-----
Von: Yang Xia <[email protected]> 
Gesendet: Dienstag, 2. Januar 2024 21:15
An: [email protected]
Betreff: Re: Gremlin.Net issue with .Net 8 Runtime

Hi Eric,

Thank you for calling out the issue. I don't believe this has been reported as 
we build and test Gremlin .NET on 6. Would you mind opening a Jira for this at 
https://issues.apache.org/jira/projects/TINKERPOP/issues? If you don't have a 
Jira account on Apache for reporting issues we'd encourage you to request one 
to facilitate additional discussions. We're also happy to open the Jira for you 
otherwise.

It would also help if you can add information regarding the database you are 
connecting to, query you are sending, and your system environment.
Thanks!

Cheers,

Yang

On Wed, Dec 27, 2023 at 8:45 AM Eric Sites <[email protected]> wrote:

> All,
>
> I am having a lot of issues using the Gremlin.Net driver version 3.7.1 
> with .Net 8.
>
> It is almost entirely unusable.
>
> Any request that uses an Iterator throws an exception (MoveNext, Next, 
> Iterate).
> System.InvalidOperationException: Enumeration has not started. Call 
> MoveNext.
>
> Tracked it down to a change in .Net 8 IEnumerable<T>.Current behavior.
> Here is an issue about this filed in dotnet runtime:
> https://github.com/dotnet/runtime/issues/85243
>
> New bad code:
> var enumerator = saves.GetEnumerator(); while (enumerator.Current == 
> null) // <- Throws exception now {
>    if (!enumerator.MoveNext())
>       return list;
> }
>
> Should be changed to something like this:
> while (enumerator.MoveNext())
> {
>     var item = enumerator.Current;
> }
>
> Here is an example of the issue in the Gremlin.Net code:
>
> https://github.com/apache/tinkerpop/blob/e8b9532fc0ec811460e97ebf5e00b
> 8b9ec9192ac/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTr
> aversal.cs#L132
>
>  private object? GetCurrent()
> {
>     // Use dynamic to object to prevent runtime dynamic conversion 
> evaluation
>     return TraverserEnumerator.Current?.Object;
> }
>
> Is this a know issue, is anyone working on it.
>
> Cheers,
> Eric Sites
>
>

Reply via email to