System.Reflection.TargetParameterCountException: Parameter count mismatch.
I'm trying to flatten and save a complex object that has a Dictionary.
So I found the closed issue with the same question (https://github.com/Azure/azure-cosmos-table-dotnet/issues/29).
The solution was to use ObjectFlattenerRecomposer, but it has some assembly references issue with Microsoft.Azure and Microsoft.WindowsAzure namespaces.
Do you have any plans to implement flattening for Dictionary with TableEntity.Flatten() method?
SDK version - Microsoft.Azure.Cosmos.Table 1.0.8 and .Net 5
Issue reproduce steps
public class MyEntity : TableEntity
{
public const string DefaultPartitionKey = "MyKey";
public MyEntity()
{}
public MyEntity(string id) : base(DefaultPartitionKey, id)
{
Id = id;
}
public string Id { get; set; }
public string Name { get; set; }
public Dictionary<string, string> Assets { get; set; }
}
DynamicTableEntity dynamicTableEntity =
new DynamicTableEntity(item.Value.PartitionKey, item.Value.RowKey);
var flattenedProperties = TableEntity.Flatten(item, new OperationContext());
** Any other context, such as stack trace or log.
Stacktrace:
System.Reflection.TargetParameterCountException: Parameter count mismatch.
at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
at Microsoft.Azure.Cosmos.Table.EntityPropertyConverter.<>c__DisplayClass5_0.<Flatten>b__1(PropertyInfo propertyInfo)
at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
at Microsoft.Azure.Cosmos.Table.EntityPropertyConverter.Flatten(Dictionary`2 propertyDictionary, Object current, String objectPath, HashSet`1 antecedents, EntityPropertyConverterOptions entityPropertyConverterOptions, OperationContext operationContext)
at Microsoft.Azure.Cosmos.Table.EntityPropertyConverter.<>c__DisplayClass5_0.<Flatten>b__1(PropertyInfo propertyInfo)
at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
at Microsoft.Azure.Cosmos.Table.EntityPropertyConverter.Flatten(Dictionary`2 propertyDictionary, Object current, String objectPath, HashSet`1 antecedents, EntityPropertyConverterOptions entityPropertyConverterOptions, OperationContext operationContext)
at Microsoft.Azure.Cosmos.Table.EntityPropertyConverter.Flatten(Object root, EntityPropertyConverterOptions entityPropertyConverterOptions, OperationContext operationContext)
at Microsoft.Azure.Cosmos.Table.EntityPropertyConverter.Flatten(Object root, OperationContext operationContext)
at Microsoft.Azure.Cosmos.Table.TableEntity.Flatten(Object entity, OperationContext operationContext)
System.Reflection.TargetParameterCountException: Parameter count mismatch. I'm trying to flatten and save a complex object that has a Dictionary. So I found the closed issue with the same question (https://github.com/Azure/azure-cosmos-table-dotnet/issues/29). The solution was to use ObjectFlattenerRecomposer, but it has some assembly references issue with Microsoft.Azure and Microsoft.WindowsAzure namespaces. Do you have any plans to implement flattening for Dictionary with
TableEntity.Flatten()
method?SDK version - Microsoft.Azure.Cosmos.Table 1.0.8 and .Net 5 Issue reproduce steps
** Any other context, such as stack trace or log. Stacktrace: