question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting AllowBulkExecution to true is throwing error

See original GitHub issue

We 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.Func2<System.ReadOnlyMemory1<Byte>,Microsoft.Azure.Cosmos.Serialization.HybridRow.Result>, System.Func2<System.ReadOnlyMemory1<Byte>,Microsoft.Azure.Cosmos.Serialization.HybridRow.Result>, Microsoft.Azure.Cosmos.Serialization.HybridRow.MemorySpanResizer1<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:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MatheusXaviercommented, Mar 23, 2021

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.

0reactions
rajeevramadugucommented, Mar 23, 2021

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting AllowBulkExecution to true is throwing error #2292
In Console app with AllowBulkExecution to true, it worked. I was getting this error in API. I copied "Microsoft.Azure.Cosmos.Serialization.
Read more >
System.Threading.Tasks.Task`1<Microsoft.Azure.Cosmos. ...
Removing AllowBulkExecution is working fine. I think it could be sdk issue? Setting AllowBulkExecution to true is throwing error "DocDBTrace ...
Read more >
Azure Cosmos DB SQL API-Encryption-Failure on Add ...
on click of Save, we get the following error "the collection has ClientEncryptionPolicy set, but the document to be written isn't encrypted.
Read more >
Azure Cosmos DB Bulk Execution with the .NET SDK
First, set AllowBulkExecution to true in your Cosmos client constructor. Then, populate a list of tasks, one for each operation.
Read more >
Troubleshoot an application using the Azure Cosmos DB ...
The first thing to notice in this new code, is that on the catch we're capturing an exception of type CosmosException class. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found