NullReferenceException in ExclusiveConsumer.Dispose
See original GitHub issueHello,
following scenario:
- one exclusive queue
- two cosumers trying to connect to that queue
when the second consumer tries to connect to the exclusive queue i get an ConsumerError as expected.
When i now try advancedBus.Dispose i get this exception and the connection to my RabbitMQ server is not closed:
System.NullReferenceException: Object reference not set to an instance of an object.
at EasyNetQ.Consumer.ExclusiveConsumer.Dispose() in C:\Projekte\EasyNetQ-3.4.0\Source\EasyNetQ\Consumer\ExclusiveConsumer.cs:line 122
at EasyNetQ.Consumer.ConsumerFactory.Dispose() in C:\Projekte\EasyNetQ-3.4.0\Source\EasyNetQ\Consumer\ConsumerFactory.cs:line 91
at EasyNetQ.RabbitAdvancedBus.Dispose() in C:\Projekte\EasyNetQ-3.4.0\Source\EasyNetQ\RabbitAdvancedBus.cs:line 931
at Fso.Sync.Service.EasyNetQueue.Close() in C:\Projekte\fso\fso-sync-service\Fso.Sync.Service\EasyNetQueue.cs:line 186
After looking at the sourcecode i see that consumerCancellation is null
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:11 (9 by maintainers)
Top Results From Across the Web
BinaryReader throws NullReferenceException when being ...
1 Answer 1 ... When the File.Open call fails, the exception is thrown without anything being assigned to the br field. When you...
Read more >Null reference exception in the close function - Dispose ...
I am using dispose pattern to clear Postgresql resources. Occasionally following exception is thrown. Do you have ideas what can cause this ...
Read more >Null Reference Exceptions
Null Reference Exceptions. A NullReferenceException happens when you try to access a reference variable that isn't referencing any object.
Read more >Object Reference Not Set to an Instance of an Object
This exception is thrown when you try to access a member—for instance, a method or a property—on a variable that currently holds a...
Read more >AccordionControl - NullReferenceException occurs when ...
AccordionControl - NullReferenceException occurs when Accordion Control is disposed of and the SelectedElement property is set to null.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have not started using the updated version of EasyNetQ yet so I don’t have a code example to give to you.
From: Yury Pliner notifications@github.com Sent: Tuesday, March 12, 2019 3:04 PM To: EasyNetQ/EasyNetQ EasyNetQ@noreply.github.com Cc: Robert Taylor rtaylor@ddti.net; Mention mention@noreply.github.com Subject: Re: [EasyNetQ/EasyNetQ] NullReferenceException in ExclusiveConsumer.Dispose (#904)
@rtaylor01https://github.com/rtaylor01 Could you help us and tell how you use that cancellation? It would be better if you could show the code.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/EasyNetQ/EasyNetQ/issues/904#issuecomment-472139270, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Ai-CGOIK7pcqYlrAEfSQZFzLdekkqgcgks5vV_okgaJpZM4bE6cO.
Thanks.
I confirm we have a bug and it was caused by #875, but I’m not sure
consumerCancellation?.OnCancel(queue);
is nice fix.