question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException in ExclusiveConsumer.Dispose

See original GitHub issue

Hello,

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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
rtaylor01commented, Mar 12, 2019

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.

1reaction
Plinercommented, Feb 25, 2019

Thanks.

I confirm we have a bug and it was caused by #875, but I’m not sure consumerCancellation?.OnCancel(queue); is nice fix.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found