When using the .NET Standard SDK with the Emulator (v2.11.5.0) and trying to create a Container with the AnalyticalStoreTimeToLiveInSeconds set on the ContainerProperties object, the following exception is thrown:
Microsoft.Azure.Cosmos.CosmosException: 'Response status code does not indicate success: BadRequest (400); Substatus: 0; ActivityId: c4b8a5d2-29e3-4720-918c-123eb10da0a4; Reason: (Message: {"Errors":["The input content is invalid - 'analyticalStorageTtl' is not a valid property in the current payload."]}
ActivityId: c4b8a5d2-29e3-4720-918c-123eb10da0a4, Request URI: /apps/DocDbApp/services/DocDbMaster0/partitions/780e44f4-38c8-11e6-8106-8cdcd42c33be/replicas/1p/, RequestStats: , SDK: Microsoft.Azure.Documents.Common/2.11.0, Please see CosmosDiagnostics, Windows/10.0.18362 cosmos-netstandard-sdk/3.11.4);'
There is no error when using cloud hosted CosmosDB, only when using the emulator. Internet searches yield nothing about this, anyone have any ideas?
Code to reproduce
Program.cs:
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;
namespace ConsoleApp2
{
public class Program
{
public static async Task Main(string[] args)
{
const string databaseName = "TestDatabase";
const string containerName = "TestContainer";
var accountEndpoint = "https://localhost:8081";
var authKey = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
var cosmosClient = new CosmosClient(accountEndpoint, authKey);
await cosmosClient.CreateDatabaseIfNotExistsAsync(databaseName, 400);
var database = cosmosClient.GetDatabase(databaseName);
await database.CreateContainerAsync(new ContainerProperties
{
Id = containerName,
PartitionKeyPath = "/id",
AnalyticalStoreTimeToLiveInSeconds = 0 // Removing this line makes the exception go away
});
}
}
}
ConsoleApp2.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.12.0" />
</ItemGroup>
</Project>