diff --git a/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs b/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs
index 0b73a1a349..47f84fd280 100644
--- a/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs
+++ b/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs
@@ -79,7 +79,7 @@ public override string ToString()
{
if (this.PartitionKey.IsNone)
{
- return "None";
+ return PartitionKey.NoneString;
}
return this.PartitionKey.InternalKey.ToJsonString();
diff --git a/Microsoft.Azure.Cosmos/src/PartitionKey.cs b/Microsoft.Azure.Cosmos/src/PartitionKey.cs
index 86e0bbae58..959175d2ae 100644
--- a/Microsoft.Azure.Cosmos/src/PartitionKey.cs
+++ b/Microsoft.Azure.Cosmos/src/PartitionKey.cs
@@ -48,6 +48,11 @@ namespace Microsoft.Azure.Cosmos
///
internal bool IsNone { get; }
+ ///
+ /// String representation of None for use when representing Partition Key as none.
+ ///
+ internal const string NoneString = "None";
+
///
/// Creates a new partition key value.
///
@@ -173,6 +178,11 @@ public bool Equals(PartitionKey other)
/// The string representation of the partition key value
public override string ToString()
{
+ if (this.IsNone)
+ {
+ return NoneString;
+ }
+
if (this.InternalKey == null)
{
return PartitionKey.NullPartitionKeyInternal.ToJsonString();
diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyTests.cs
index c5c2be4ea7..cac1d9ab72 100644
--- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyTests.cs
+++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/PartitionKeyTests.cs
@@ -88,6 +88,15 @@ public void TestPartitionKeyDefinitionAreEquivalent()
Assert.IsTrue(PartitionKeyDefinition.AreEquivalent(definition1, definition2));
}
+ [TestMethod]
+ public void NoneToStringNotNullRef()
+ {
+ const string noneString = "None";
+ Cosmos.PartitionKey noneKey = Cosmos.PartitionKey.None;
+
+ Assert.AreEqual(noneString, noneKey.ToString());
+ }
+
[TestMethod]
public void RoundTripTests()
{