-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Have HttpClientHandler throw the InnerException when catching TargetInvocationException #56334
Have HttpClientHandler throw the InnerException when catching TargetInvocationException #56334
Conversation
…nvocationException Originally on mobile workloads when UseNativeHttpHandler is set to true, all reflection method invokes bubbled up a TargetInvocationException. To make the details a bit more readable, we will instead rethrow the InnerException. Fixes dotnet#56089
Tagging subscribers to this area: @dotnet/ncl Issue DetailsOriginally on mobile workloads when UseNativeHttpHandler is set to true, all reflection method invokes Fixes #56089
|
catch (TargetInvocationException e) | ||
{ | ||
ExceptionDispatchInfo.Capture(e.InnerException!).Throw(); | ||
throw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant? Wouldn't the line above already throw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's needed to trick the analyzer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good after addressing if the .Throw();
and throw;
are redundant
Could use the static method ExceptionDispatchInfo.Throw(Exception) from dotnet/coreclr#10489, if this isn't targeting any older frameworks.
Line 63 in c5b41e9
|
Originally on mobile workloads when UseNativeHttpHandler is set to true, all reflection method invokes
bubbled up a TargetInvocationException. To make the details a bit more readable, we will instead rethrow
the InnerException.
Fixes #56089