-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EndpointResolverExtensions-SelectOne trashes exception stack trace #376
Comments
@CornedBee would you be interested in submitting a PR that does the latter? |
Sure, can do. Tip of tree is broken though due to a mismerge of pull request #368. |
… and rethrow them as an AggregateException. Fixes rabbitmq#376.
That PR also unbreaks the build. |
@CornedBee can you please clarify what kind of "mismerge" you are referring to? |
@michaelklishin At revision 2746891, client/impl/Connection.cs contains the following code:
Note that this is the same block of code repeated twice, leading to a multiple declaration error. The first of the two commits in my PR removed one of the duplicates. I call it a mismerged because this duplication is a result of both branches being merged introducing this change, but the merge algorithm not recognizing it as the same. (This is because in one branch, it was a strict addition, while in the other, there was also a line removed just above, making it a replacement.) |
It looks like CI was not run for #368: |
Here, inside the loop the code captures exceptions from attempts to connect to the endpoints. It remembers the last one, and at the end, if it didn't get a successful result, it rethrows this last exception.
However, in doing so, it trashes the stack trace of the exception, making debugging the underlying problem hard or impossible. (In my particular case, I'm getting a TypeInitializerException complaining that it can't initialize Interop.Http - but RabbitMQ has, according to my decompiler, no direct or indirect dependency on System.Net.Http ...)
It should do one of two things:
Simple: It should rethrow the exception using the ExceptionDispatchInfo method:
More complicated but better: it should capture all exceptions and wrap them in an AggregateException:
The text was updated successfully, but these errors were encountered: