Reputation: 86967
I'm trying to do the following code which doesn't compile:
var message = new CloudQueueMessage(item);
return queue.AddMessageAsync(message, cancellationToken);
The compiler says there is no method which only accepts 2x arguments.
The offical MS documentation says there should be a method which does accept 2x arguments.
The official code on GitHub also suggests that there should be a method which does accept 2x arguments ...
I'm using Assembly Microsoft.WindowsAzure.Storage, Version=9.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
via NuGet which lists only these 3 methods:
public virtual Task AddMessageAsync(CloudQueueMessage message);
public virtual Task AddMessageAsync(CloudQueueMessage message, TimeSpan? timeToLive, TimeSpan? initialVisibilityDelay, QueueRequestOptions options, OperationContext operationContext, CancellationToken cancellationToken);
public virtual Task AddMessageAsync(CloudQueueMessage message, TimeSpan? timeToLive, TimeSpan? initialVisibilityDelay, QueueRequestOptions options, OperationContext operationContext);
So can someone explain:
CancellationToken
to the method? pass null
for each argument?This is for a .NET Core project.
Upvotes: 0
Views: 978
Reputation: 17790
Storage SDK for .NET Framework and .NET Core has minor differences, which are not clarified in the docs.
Begin with v9.2.0, AddMessageAsync(CloudQueueMessage message, CancellationToken cancellationToken)
method has been removed in .NET Core SDK. So one workaround is to downgrade sdk to v9.1.1.
Good news is that the differences will be eliminated in next version of Azure Storage Package. See related issue comment.
This library is set to target .NET Standard 2.0 and will not contain these minor API differences.
So another workaround is to use preview version before it becomes generally available.
Note that namespace is changed in preview version.
using Microsoft.Azure.Storage;
using Microsoft.Azure.Storage.Queue;
Upvotes: 2