Using Azure.Data.Tables
12.3.0 and trying to save the following sample model I get the error:
System.NotSupportedException: Not supported type System.Collections.Generic.Dictionary [System.Guid,System.Guid] at Azure.Core.Utf8JsonWriterExtensions.WriteObjectValue(Utf8JsonWriter writer, Object value) at Azure.Data.Tables.TableRestClient.CreateInsertEntityRequest(String table, Nullable timeout, Nullable responsePreference, IDictionary tableEntityProperties, QueryOptions queryOptions)
PersistedPerson.cs
class PersistedPerson
{
string Name { get; init; }
Dictionary<Guid, Guid> SomeDictionary { get; init; } = new();
}
To save the entity I'm creating it and passing it into my repository where I create the TableClient and save the entity as follows:
var tableClient = new TableClient(tableStorageConfiguration.ConnectionString, tableName);
await tableClient.AddEntityAsync(persistedModel, cancellationToken);
I can save this object without issue using Microsoft.Azure.Cosmos
along with Cosmos DB (emulator and the service). I have tried using the Azure Storage Emulator 5.1.0 and Azure Table Storage (online). It also doesn't seem to matter what data types are used in the dictionary; I get the same error.
Any suggestions? I can't find a lot of information out there about what serialization support there is for this library. It looks like it's serializing using a JSON writer of some kind and I've verified System.Text.Json
is supported.
[Update] Swapping out library and underlying implementation did indeed fix this issue. Works fine in CosmosDb (SQL) but not CosmosDb Tables.