You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/01/03 16:25:00 UTC
[jira] [Commented] (TINKERPOP-3029) Gremlin.Net: Traversal enumeration fails on .NET 8
[ https://issues.apache.org/jira/browse/TINKERPOP-3029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17802254#comment-17802254 ]
ASF GitHub Bot commented on TINKERPOP-3029:
-------------------------------------------
FlorianHockmann opened a new pull request, #2424:
URL: https://github.com/apache/tinkerpop/pull/2424
https://issues.apache.org/jira/browse/TINKERPOP-3029
`IEnumerable<T>.Current` has been changed in .NET 8. Before .NET 8, it simply returned `null` if `MoveNext()` wasn't called first. With .NET 8 however it throws an exception.
Since this has apparently already been undefined behavior before, we should fix this irrespective of .NET 8:
https://github.com/dotnet/runtime/issues/85243#issuecomment-1521085177
The problem can be reproduced by executing the Gherkin tests with .NET without the change in `DefaultTraversal` (by changing the `TargetFramework` in `Gremlin.Net.IntegrationTest.csproj` to `net8.0`). .NET 8 needs to be installed for this of course.
VOTE +1
> Gremlin.Net: Traversal enumeration fails on .NET 8
> --------------------------------------------------
>
> Key: TINKERPOP-3029
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3029
> Project: TinkerPop
> Issue Type: Bug
> Components: dotnet
> Affects Versions: 3.5.8, 3.6.6, 3.7.1
> Reporter: Florian Hockmann
> Assignee: Florian Hockmann
> Priority: Critical
>
> This has been reported by Eric Sites on the dev mailing list: [https://lists.apache.org/thread/snztwgk3s18h83mx8ql455hmx6ncl2r4]
> ----
> 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:
> {code:java}
> var enumerator = saves.GetEnumerator();
> while (enumerator.Current == null) // <- Throws exception now
> {
> if (!enumerator.MoveNext())
> return list;
> }
> {code}
> Should be changed to something like this:
> {code:java}
> while (enumerator.MoveNext())
> {
> var item = enumerator.Current;
> }
> {code}
> Here is an example of the issue in the Gremlin.Net code:
> [https://github.com/apache/tinkerpop/blob/e8b9532fc0ec811460e97ebf5e00b8b9ec9192ac/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/DefaultTraversal.cs#L132]
> {code:java}
> private object? GetCurrent()
> {
> // Use dynamic to object to prevent runtime dynamic conversion evaluation
> return TraverserEnumerator.Current?.Object;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)