This might be specific for my case, but I think I found the problem (thanks to the guys from MassTransit).
The problem was that my consumer starter a new thread.
Public Sub Consume(message As IConsumeContext(Of IMessage)) Implements Consumes(Of IConsumeContext(Of IMessage)).All.Consume
HandleMessageAsync(message)
End Sub
Private Async Sub HandleMessageAsync(context As IConsumeContext(Of IMessage))
Dim something = Await _controller.GetSomething(context.Message)
Dim response As New MessageResponse
response.something = something
context.Respond(response)
End Sub
This thread lives out of the grasp of MassTransit so it can't catch any exception from that thread. The solution for me was to change it to:
Public Sub Consume(context As IConsumeContext(Of IMessage)) Implements Consumes(Of IConsumeContext(Of IMessage)).All.Consume
Dim something = _controller.GetSomething(context.Message).Result
Dim response As New MessageResponse
response.something = something
context.Respond(response)
End Sub
Just make sure the exception bubbles up before the Consume method exits. Otherwise you have to catch it yourself.