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.
Redundant? Wouldn't the line above already throw?
There was a problem hiding this comment.
It's needed to trick the analyzer.
mdh1418
left a comment
There was a problem hiding this comment.
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. |
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