Ok, I have a class intended to manage Azure cloud queue messages, the insertions are working fine:
public async void Insert(string message)
{
await Queue.AddMessageAsync(new CloudQueueMessage(message));
}
Note that this Queue
is a CloudQueue
instance.
This is the message inserted in the storage using the above method
But, while trying to Get or Peek messages, a weird behavior is happening and I can't read anything of the content:
The content of the message is throwing an exception and is being returned as null.
This is the messageCount
value.
Here's textually, the method used to retrieve the messages:
public async Task<List<string>> GetMessages()
{
var list = new List<string>();
await Queue.FetchAttributesAsync();
int messageCount = Queue.ApproximateMessageCount ?? 0;
if (messageCount == 0) return list;
foreach (var msg in await Queue.GetMessagesAsync(messageCount))
{
list.Add(msg.AsString);
}
return list;
}
EDIT: I checked as pointed in the approved answer and figured out that I was using a deprecated package that seems to work no longer.
This library has been split in multiple parts and is deprecated.
I had to use a most recent API and change my code, it's actually easier to use but a certain rework was needed. It's now working, and the way to use the queue in this new version (.NET v12) is documented here.