0

I have this simple code:

  QueueClient azQueue = new QueueClient(@"<connection string>", "test-queue");                
  azQueue.SendMessage("test®test");

and it fails with message: "Retry failed after 6 tries." If I remove ® character from string it sends message with no issue. Please help me handle special characters properly.

Georgy Nevsky
  • 111
  • 1
  • 4
  • 8

1 Answers1

2

I believe you are using newer SDK Azure.Storage.Queues which does not automatically encode the message in Base64 like the previous ones Microsoft.Azure.Storage.Queue or WindowsAzure.Storage (deprecated). So it's better to encode your message like below. Also refer this: https://github.com/Azure/azure-sdk-for-net/issues/11358 and there is also a feature request https://github.com/Azure/azure-sdk-for-net/issues/10242.

  QueueClient azQueue = new QueueClient(@"<connection string>", "test-queue");                
  azQueue.SendMessage(Convert.ToBase64String(Encoding.UTF8.GetBytes("test®test")));
krishg
  • 5,935
  • 2
  • 12
  • 19
  • Yes I'm using latest Azure.Storage.Queues 12.4.2. So I have to encode all messages to base64? And max size of message will be encoded to base64, right? Strange it is not mentioned in ms docs. – Georgy Nevsky Sep 22 '20 at 13:16
  • Yes. Unfortunately current doc does not mention this clearly. There is also a feature request https://github.com/Azure/azure-sdk-for-net/issues/10242. – krishg Sep 22 '20 at 13:26