diff --git a/src/protobuf-net.Grpc.Reflection/ReflectionService.cs b/src/protobuf-net.Grpc.Reflection/ReflectionService.cs index dd46e050..c6f6b1b7 100644 --- a/src/protobuf-net.Grpc.Reflection/ReflectionService.cs +++ b/src/protobuf-net.Grpc.Reflection/ReflectionService.cs @@ -153,19 +153,19 @@ public int Compare(FileDescriptorProto? left, FileDescriptorProto? right) { if (left is null) { - return right is null ? 0 : -1; + return right is null ? 0 : 1; } if (right is null) { - return 1; + return -1; } if (GetTransitiveDependencies(left).Contains(right.Name)) { - return 1; + return -1; } if (GetTransitiveDependencies(right).Contains(left.Name)) { - return -1; + return 1; } return string.Compare(left.Name, right.Name, StringComparison.Ordinal); diff --git a/tests/protobuf-net.Grpc.Reflection.Test/ReflectionServiceTests.cs b/tests/protobuf-net.Grpc.Reflection.Test/ReflectionServiceTests.cs index 8fd77807..6c8093fa 100644 --- a/tests/protobuf-net.Grpc.Reflection.Test/ReflectionServiceTests.cs +++ b/tests/protobuf-net.Grpc.Reflection.Test/ReflectionServiceTests.cs @@ -74,9 +74,9 @@ async IAsyncEnumerable GetRequest() ".ReflectionTest.BclService", new[] { + "ReflectionTest.BclService.proto", "google/protobuf/empty.proto", - "protobuf-net/bcl.proto", - "ReflectionTest.BclService.proto" + "protobuf-net/bcl.proto" } , new[]