[
https://issues.apache.org/jira/browse/TINKERPOP-2976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750593#comment-17750593
]
ASF GitHub Bot commented on TINKERPOP-2976:
-------------------------------------------
FlorianHockmann commented on code in PR #2176:
URL: https://github.com/apache/tinkerpop/pull/2176#discussion_r1282719355
##########
gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphBinary/TypeSerializerRegistry.cs:
##########
@@ -199,7 +199,7 @@ public ITypeSerializer GetSerializerFor(Type valueType)
return serializer;
}
- foreach (var supportedType in _serializerByType.Keys)
+ foreach (var supportedType in new
List<Type>(_serializerByType.Keys))
Review Comment:
Removing a serializer isn't really supported so I don't see how that could
happen.
Do you see a good use case where someone would actually want to remove a
serializer?
> InvalidOperationException: Collection was modified in GraphBinary
> serialization
> -------------------------------------------------------------------------------
>
> Key: TINKERPOP-2976
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2976
> Project: TinkerPop
> Issue Type: Bug
> Components: dotnet
> Affects Versions: 3.5.6, 3.6.4
> Reporter: Florian Hockmann
> Priority: Minor
>
> This was first reported for JanusGraph.Net:
> [https://github.com/JanusGraph/janusgraph-dotnet/issues/140]
> but the issue is most likely in Gremlin.Net.
> {code:java}
> System.InvalidOperationException: Collection was modified; enumeration
> operation may not execute.
> at
> System.Collections.Generic.Dictionary2.KeyCollection.Enumerator.MoveNext()
> at
> Gremlin.Net.Structure.IO.GraphBinary.TypeSerializerRegistry.GetSerializerFor(Type
> valueType)
> at Gremlin.Net.Structure.IO.GraphBinary.GraphBinaryWriter.WriteAsync(Object
> value, Stream stream, CancellationToken cancellationToken)
> [...]{code}
> The problem is most likely that the driver iterates over all supported types
> in a {{foreach}} loop to find a type to which the type to be serialized can
> be assigned which means that the same serializer can be used. Then this
> serializer is registered for the new type which modifies the collection the
> {{foreach}} is iterated on, leading to this error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)