You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the unit test WithBuggySerializer_FailsSometimes()multiple times until it fails (10 executions should be enough)
What is expected?
I've add a straight-forward implementation of a CompositeNodeIdValueSerializer<CompositeNodeId> whose CompositeNodeId consists of 2 Guid's.
The expectiation is that this implementation can format and parse again any combination of 2 Guid's without errors.
What is actually happening?
For some combinations of 2 Guid's the parsing fails with an error indicating that the formatted id is invalid.
Debugging the CompositeNodeIdValueSerializer<T> base implementation showed that it fails in case the formatting of one of the Guid's contains a byte value which corresponds to the part separator (':'). In this case parsing will fail as the parsing implementation depends on the uniqueness of this separator which is not guaranteed.
I guess there won't be any part separator that for sure won't be produced on formatting the single Guid's. Therefore - as a workaround - I created my custom TryParse() and TryFormatIdPart() implementations which take an additional position argument in order to locate the Guid's properly. It makes the use of a part separator obsolete.
My custom implementation can be found in the AlternativeCompositeNodeIdSerializer class in the reproduction repository. With this implementation, the same unit test always passes.
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered:
Product
Hot Chocolate
Version
15.1.3
Link to minimal reproduction
https://github.com/metalium84/hc-comp-node-id-serializer-bug.git
Steps to reproduce
WithBuggySerializer_FailsSometimes()
multiple times until it fails (10 executions should be enough)What is expected?
I've add a straight-forward implementation of a
CompositeNodeIdValueSerializer<CompositeNodeId>
whoseCompositeNodeId
consists of 2 Guid's.The expectiation is that this implementation can format and parse again any combination of 2 Guid's without errors.
What is actually happening?
For some combinations of 2 Guid's the parsing fails with an error indicating that the formatted id is invalid.
Debugging the
CompositeNodeIdValueSerializer<T>
base implementation showed that it fails in case the formatting of one of the Guid's contains a byte value which corresponds to the part separator (':'). In this case parsing will fail as the parsing implementation depends on the uniqueness of this separator which is not guaranteed.I guess there won't be any part separator that for sure won't be produced on formatting the single Guid's. Therefore - as a workaround - I created my custom
TryParse()
andTryFormatIdPart()
implementations which take an additional position argument in order to locate the Guid's properly. It makes the use of a part separator obsolete.My custom implementation can be found in the
AlternativeCompositeNodeIdSerializer
class in the reproduction repository. With this implementation, the same unit test always passes.Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: