Unhandled Exception in RabbitMQ Message Consumer Thread, was not caught by AppDomain.CurrentDomain.UnhandledException #1650
-
Hi, We have an application which throws an unhandled exception in the message consumer thread, but AppDomain.CurrentDomain.UnhandledException event didn't get triggered. I have attached the some example code below. Please help us. We would be appreciate if you can schedule a meeting to review this case. Thanks, Pramod Code Example: AppDomain.CurrentDomain.UnhandledException += AppDomain_UnhandledException;
consumer.Received += (model, ea) =>
{
var body = ea.Body.ToArray();
var props = ea.BasicProperties;
throw new Exception("consumer errror 2");
}; |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@Pramod34 we will not schedule any meetings with users who are neither paying customers nor contributors. We do not have any relevant information to work with:
In general, RabbitMQ clients expect applications to handle consumer exceptions because libraries It may be reasonable to expect un unhandled exception to be propagated as a |
Beta Was this translation helpful? Give feedback.
-
I created some example code to show how to deal with exceptions in event handlers, like for the 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 We do not support version 5 of this library, however, this is the code in version 6 that calls callback exception handlers: You can see that the exception is swallowed. In your case, you should use the |
Beta Was this translation helpful? Give feedback.
@Pramod34 we will not help you with your internal library, that's literally your job. All the decisions in that library are your decisions and your responsibility.
How you decide to monitor unhandled exceptions in your internal library should not drive the design decisions of the client, and even more so when you use a 5.x series (you are almost two major releases behind, 7.x is about to be released).