@@ -385,8 +385,6 @@ private static ORSet<T> ToGenericORSet<T>(ImmutableDictionary<object, VersionVec
385
385
private static readonly MethodInfo ORSetUnknownMaker =
386
386
typeof ( ReplicatedDataSerializer ) . GetMethod ( nameof ( ORSetUnknownToProto ) , BindingFlags . Instance | BindingFlags . NonPublic ) ;
387
387
388
- private static readonly OtherMessageComparer OtherMessageComparer = new OtherMessageComparer ( ) ;
389
-
390
388
/// <summary>
391
389
/// Called when we're serializing none of the standard object types with ORSet
392
390
/// </summary>
@@ -405,7 +403,7 @@ private Proto.Msg.ORSet ORSetUnknownToProto<T>(IORSet o, Proto.Msg.ORSet b)
405
403
otherElements . Add ( otherElement ) ;
406
404
otherElementsDict [ otherElement ] = SerializationSupport . VersionVectorToProto ( kvp . Value ) ;
407
405
}
408
- otherElements . Sort ( OtherMessageComparer ) ;
406
+ otherElements . Sort ( OtherMessageComparer . Instance ) ;
409
407
410
408
foreach ( var val in otherElements )
411
409
{
@@ -531,9 +529,14 @@ private Proto.Msg.GSet GSetToProto<T>(GSet<T> gset)
531
529
private Proto . Msg . GSet GSetToProtoUnknown < T > ( IGSet g )
532
530
{
533
531
var gset = ( GSet < T > ) g ;
534
- var p = new Proto . Msg . GSet ( ) ;
535
- p . TypeInfo = GetTypeDescriptor ( typeof ( T ) ) ;
536
- p . OtherElements . Add ( gset . Select ( x => _ser . OtherMessageToProto ( x ) ) ) ;
532
+ var otherElements = new List < OtherMessage > ( gset . Select ( x => _ser . OtherMessageToProto ( x ) ) ) ;
533
+ otherElements . Sort ( OtherMessageComparer . Instance ) ;
534
+
535
+ var p = new Proto . Msg . GSet
536
+ {
537
+ TypeInfo = GetTypeDescriptor ( typeof ( T ) )
538
+ } ;
539
+ p . OtherElements . Add ( otherElements ) ;
537
540
return p ;
538
541
}
539
542
@@ -547,25 +550,33 @@ private Proto.Msg.GSet ToProto(IGSet gset)
547
550
case GSet < int > ints :
548
551
{
549
552
var p = GSetToProto ( ints ) ;
550
- p . IntElements . Add ( ints . Elements ) ;
553
+ var intElements = new List < int > ( ints . Elements ) ;
554
+ intElements . Sort ( ) ;
555
+ p . IntElements . Add ( intElements ) ;
551
556
return p ;
552
557
}
553
558
case GSet < long > longs :
554
559
{
555
560
var p = GSetToProto ( longs ) ;
556
- p . LongElements . Add ( longs . Elements ) ;
561
+ var longElements = new List < long > ( longs . Elements ) ;
562
+ longElements . Sort ( ) ;
563
+ p . LongElements . Add ( longElements ) ;
557
564
return p ;
558
565
}
559
566
case GSet < string > strings :
560
567
{
561
568
var p = GSetToProto ( strings ) ;
562
- p . StringElements . Add ( strings . Elements ) ;
569
+ var stringElements = new List < string > ( strings . Elements ) ;
570
+ stringElements . Sort ( ) ;
571
+ p . StringElements . Add ( stringElements ) ;
563
572
return p ;
564
573
}
565
574
case GSet < IActorRef > refs :
566
575
{
567
576
var p = GSetToProto ( refs ) ;
568
- p . ActorRefElements . Add ( refs . Select ( Akka . Serialization . Serialization . SerializedActorPath ) ) ;
577
+ var refElements = new List < IActorRef > ( refs . Elements ) ;
578
+ refElements . Sort ( ) ;
579
+ p . ActorRefElements . Add ( refElements . Select ( Akka . Serialization . Serialization . SerializedActorPath ) ) ;
569
580
return p ;
570
581
}
571
582
default : // unknown type
0 commit comments