Azure / azure-cosmos-dotnet-v2

Contains samples and utilities relating to the Azure Cosmos DB .NET SDK
MIT License
579 stars 840 forks source link

MissingMethodException using ChangefeedProcessor on top of docdb sdk 2.0 #578

Open eiriktsarpalis opened 5 years ago

eiriktsarpalis commented 5 years ago

Attempting to use the ChangefeedProcessor library on top of CosmosDB SDK 2.0 results in the following runtime error:

System.MissingMethodException: Method not found: 'System.Threading.Tasks.Task`1<Microsoft.Azure.Documents.Client.ResourceResponse`1<Microsoft.Azure.Documents.Document>> Microsoft.Azure.Documents.Client.DocumentClient.ReadDocumentAsync(System.Uri, Microsoft.Azure.Documents.Client.RequestOptions)'.
   at Microsoft.Azure.Documents.ChangeFeedProcessor.DataAccess.ChangeFeedDocumentClient.ReadDocumentAsync(Uri documentUri)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.Azure.Documents.ChangeFeedProcessor.DataAccess.ChangeFeedDocumentClient.ReadDocumentAsync(Uri documentUri)
   at Microsoft.Azure.Documents.ChangeFeedProcessor.Utils.DocumentClientExtensions.TryGetDocumentAsync(IChangeFeedDocumentClient client, Uri documentUri)
   at Microsoft.Azure.Documents.ChangeFeedProcessor.Bootstrapping.LeaseStore.IsInitializedAsync()
   at Microsoft.Azure.Documents.ChangeFeedProcessor.Bootstrapping.Bootstrapper.InitializeAsync()
   at Microsoft.Azure.Documents.ChangeFeedProcessor.PartitionManagement.PartitionManager.StartAsync()
   at Microsoft.Azure.Documents.ChangeFeedProcessor.ChangeFeedProcessor.StartAsync()

Seems to be caused by a break in the CosmosDB SDK ABI, due to the addition of a cancellation token as optional argument. This issue blocks our ability to run changefeed on Linux (due to issue #194). This problem can be fixed trivially by releasing a build of the changefeed library (say, a 2.1 prerelease?) that targets version 2.0 of the SDK.

ealsur commented 5 years ago

@eiriktsarpalis What version of the Change Feed Processor library are you using?

eiriktsarpalis commented 5 years ago

ChangeFeed version 2.0.6 and Core SDK version 2.0.0-preview2

ealsur commented 5 years ago

@eiriktsarpalis I created an issue in the CFP Library repo to track and a PR to address it: https://github.com/Azure/azure-documentdb-changefeedprocessor-dotnet/pull/97

eiriktsarpalis commented 5 years ago

Thanks, I wasn't aware of that repo.

eiriktsarpalis commented 5 years ago

I took a look at the code, it seems that the ABI breaking change was introduced with cosmos SDK 2.0.0-preview2. I was able to get CF working after I downgraded to 2.0.0-preview.