-
Notifications
You must be signed in to change notification settings - Fork 118
ISenderClient:SendAsync(IList<Message> messageList) throws null reference when messageList is empty #550
Comments
Sorry for the late response. If you'd still like to fix it please proceed and submit a pull request. thank you ! |
I just hit the same bug |
Oh, now i have the reason to fix it 😅 I will do it this week |
Are you sure about this? Looking at the code for |
Anyway, in the meantime the workaround is simple. Don't call |
I think in the past it was throwing on the |
|
I would have expected |
Interesting. Could you elaborate why an empty collection would be a no-op, but a |
Well, the method expects a list. Null isn't a list, so obviously it should be rejected, but an empty list is still a valid list. There are many examples of methods in the BCL that accept an empty collection: |
Convinced. PR #642 will replace the original PR. |
@SeanFeldman thanks! |
Actual Behavior
Expected Behavior
Simplest repro
Reason
azure-service-bus-dotnet/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs
Line 59 in 6f144e9
dataList
is initalized in a foreach loop, so when there is no messages it will be null.Later one, its used by
amqpMessage = AmqpMessage.Create(dataList);
what causes null reference exception.Versions
I can pick up this issue if you want.
The text was updated successfully, but these errors were encountered: