Skip to content

Unhandled Exception in RabbitMQ Message Consumer Thread, was not caught by AppDomain.CurrentDomain.UnhandledException #1650

Closed Locked Answered by lukebakken
Pramod34 asked this question in Q&A
Discussion options

You must be logged in to vote

@Pramod34 -

I created some example code to show how to deal with exceptions in event handlers, like for the Received event:

https://github.com/lukebakken/rabbitmq-dotnet-client-1650/blob/main/Program.cs

When you run that console application, and publish a message to the queue, you can see that the CallbackException handler is called.

We do not support version 5 of this library, however, this is the code in version 6 that calls callback exception handlers:

https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/6.x/projects/RabbitMQ.Client/client/impl/ModelBase.cs#L400-L416

You can see that the exception is swallowed.

In your case, you should use the OnConnectionCallbackException handlers to

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@Pramod34
Comment options

@michaelklishin
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by lukebakken
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants