Setting AllowBulkExecution to true is throwing error
See original GitHub issueWe are continuously addressing and improving the SDK, if possible, make sure the problem persist in the latest SDK version.
Describe the bug Setting AllowBulkExecution to true in CosmosClientOptions is throwing "DocDBTrace Error: 0 : Exception during BatchAsyncBatcher: System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<Microsoft.Azure.Cosmos.Serialization.HybridRow.Result> "
To Reproduce
protected virtual CosmosClient _cosmosClient
{
get
{
var options = new CosmosClientOptions
{
SerializerOptions = new CosmosSerializationOptions
{
IgnoreNullValues = true,
PropertyNamingPolicy = CosmosPropertyNamingPolicy.CamelCase
},
AllowBulkExecution = true
};
return new CosmosClient(_connectionString, options);
}
}
protected Container _cosmosContainer
{
get => _cosmosClient.GetContainer(_databaseId, _containerId);
}
protected async Task<T> CreateItemAsync<T>(string id, T model, PartitionKey partitionKey)
{
try
{
return await _cosmosContainer.CreateItemAsync(model, partitionKey);
}
catch (CosmosException ex)
{
LogCosmosDbError(ex);
throw;
}
}
Error log
DocDBTrace Error: 0 : ‘Test.Api.exe’ (CoreCLR: clrhost): Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.4\System.Diagnostics.StackTrace.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled.
‘Test.Api.exe’ (CoreCLR: clrhost): Loaded ‘C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.4\System.Reflection.Metadata.dll’. Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled.
Exception during BatchAsyncBatcher: System.MissingMethodException: Method not found: ‘System.Threading.Tasks.Task1<Microsoft.Azure.Cosmos.Serialization.HybridRow.Result> Microsoft.Azure.Cosmos.Serialization.HybridRow.RecordIO.RecordIOStream.ReadRecordIOAsync(System.IO.Stream, System.Func
2<System.ReadOnlyMemory1<Byte>,Microsoft.Azure.Cosmos.Serialization.HybridRow.Result>, System.Func
2<System.ReadOnlyMemory1<Byte>,Microsoft.Azure.Cosmos.Serialization.HybridRow.Result>, Microsoft.Azure.Cosmos.Serialization.HybridRow.MemorySpanResizer
1<Byte>)’.
at Microsoft.Azure.Cosmos.TransactionalBatchResponse.PopulateFromContentAsync(Stream content, ResponseMessage responseMessage, ServerBatchRequest serverRequest, CosmosSerializerCore serializer, ITrace trace, Boolean shouldPromoteOperationStatus)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Microsoft.Azure.Cosmos.TransactionalBatchResponse.PopulateFromContentAsync(Stream content, ResponseMessage responseMessage, ServerBatchRequest serverRequest, CosmosSerializerCore serializer, ITrace trace, Boolean shouldPromoteOperationStatus)
at Microsoft.Azure.Cosmos.TransactionalBatchResponse.FromResponseMessageAsync(ResponseMessage responseMessage, ServerBatchRequest serverRequest, CosmosSerializerCore serializer, Boolean shouldPromoteOperationStatus, ITrace trace, CancellationToken cancellationToken)
at Microsoft.Azure.Cosmos.BatchAsyncContainerExecutor.ExecuteAsync(PartitionKeyRangeServerBatchRequest serverRequest, ITrace trace,
Environment summary SDK Version: .net core 5.0 and azure 3.17 sdk OS Version : Windows 10
Additional context Add any other context about the problem here (for example, complete stack traces or logs).
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
I’ve checked all my projects and they are referecing the same sdk version, so I cleaned my solution and deleted all obj and bin folders and tried again but it didn’t work. Then I tried @rajeevramadugu solution. Because I was using Microsoft.Azure.Cosmos 3.17.0 with AspNetCore.HealthChecks.CosmosDb 5.0.3, so I downgraded AspNetCore.HealthChecks.CosmosDb to version 3.1.2 and it worked.
@MatheusXavier , I had similar issue when I was using Microsoft.Azure.Cosmos 3.17 and AspNetCore.HealthChecks.CosmosDb 5.0.3. I had to downgrade AspNetCore.HealthChecks.CosmosDb to 3.x, and bin folder has now correct Microsoft.Azure.Cosmos.Serialization.HybridRow.dll version. You might be having conflicting dll issue too. cc: @ealsur