BulkWriteAsync does not interrupt when CancellationToken gets canceled

I am using the latest version of the C# Mongo Driver with a v4.2 database. When I call BulkWriteAsync (IMongoCollection(TDocument).BulkWriteAsync Method (IClientSessionHandle, IEnumerable(WriteModel(TDocument)), BulkWriteOptions, CancellationToken)) with a CancellationToken, if the cancellation token gets cancelled while the BulkWriteAsync is running, no OperationCanceledException gets thrown. This is a problem because the transaction can take a long time making the database hold a lot of locks and interfere with other requests. I need to interrupt any database commands as soon as the cancellation token cancels to reduce the risk of deadlocks caused by transactions continuing to run for too long.

Hi @Alejandro_Carrazzoni, welcome!

Could you provide a minimal reproducible code snippet to reproduce the behaviour that you’re seeing ?

Regards,
Wan.

I hit the same problem with Aggregate.
I think the root cause is this issue:
https://jira.mongodb.org/browse/CSHARP-1200
The issue was created Mar 20 2015 and is still unresolved