-
Notifications
You must be signed in to change notification settings - Fork 613
Description
Describe the bug
The new IAsyncBasicConsumer interface has a method HandleBasicDeliver and a method parameter ReadOnlyBasicProperties , but with the modifier in. You can't have in, ref in async methods. So as soon as you implement the interface and actually have anything async to do, i.e. you add the async keyword, it won't compile anymore, with CS1988 (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/ref-modifiers-errors#reference-variable-restrictions).
rabbitmq-dotnet-client/projects/RabbitMQ.Client/client/api/IAsyncBasicConsumer.cs
Lines 49 to 55 in 2a5aed7
| Task HandleBasicDeliver(string consumerTag, | |
| ulong deliveryTag, | |
| bool redelivered, | |
| string exchange, | |
| string routingKey, | |
| in ReadOnlyBasicProperties properties, | |
| ReadOnlyMemory<byte> body); |
in basically makes only sense together with ref struct and specifically ref readonly struct, atleast that's what I understand from all the discussions around https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-11.0/low-level-struct-improvements.
I highly recommend simply removing in this prior to the 7.0 release, as modifying it would be a breaking change and at the moment implementations would need to jump through loops to use it with async (async local method etc.).
In IBasicConsumer it's not there:
rabbitmq-dotnet-client/projects/RabbitMQ.Client/client/api/IBasicConsumer.cs
Lines 92 to 98 in 2a5aed7
| Task HandleBasicDeliverAsync(string consumerTag, | |
| ulong deliveryTag, | |
| bool redelivered, | |
| string exchange, | |
| string routingKey, | |
| ReadOnlyBasicProperties properties, | |
| ReadOnlyMemory<byte> body); |
Reproduction steps
Expected behavior
Additional context
No response