Closed sabbadino closed 4 years ago
When is the UserProperties
property of the incoming message null?
I don't know if the userproperty can ever be null .. it's an asb sdk read only prop ..
For sure the rebus code fails if someone put a custom header whose value is null (which is legal even if unusual.. and this was my situation)
ah, damn... that should definitely be fixed 🙂
fixed in Rebus.AzureServiceBus 7.1.1, which is out on NuGet.org now 🙂 thanks for reporting this issue!
Using Rebus service bus 7.1.0
I think this line of code has a problem var headers = userProperties.ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToString());
if kvp.Valueis null it breaks with :
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll dmbo.v3.partner.api Warning: 0 : 2020-03-17 09:39:06.085 +01:00 [Warning] An error occurred when attempting to receive the next message: "System.NullReferenceException: Object reference not set to an instance of an object. at Rebus.AzureServiceBus.AzureServiceBusTransport.<>c.b__36_4(KeyValuePair
2 kvp) at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable
1 source, Func2 keySelector, Func
2 elementSelector, IEqualityComparer`1 comparer) at Rebus.AzureServiceBus.AzureServiceBusTransport.Receive(ITransactionContext context, CancellationToken cancellationToken) at Rebus.Workers.ThreadPoolBased.ThreadPoolWorker.ReceiveTransportMessage(CancellationToken token, ITransactionContext context) in C:\projects-rebus\Rebus\Rebus\Workers\ThreadPoolBased\ThreadPoolWorker.cs:line 148"I would even check if userProperties is not null