My app is throwing a System.Net.Http.HttpRequestException when an API I use (Postmark) can't connect due to in my case proxy issues.
ex.message only gives me "An error occurred while sending the request." which is not much use in diagnosing cause
Looking in ex.message.innerexception I can see "The remote server returned an error: (403) Forbidden." which is more useful but still doesn't solve my problem
If I run the app in VS I can see that in InnerException there is Response which contains more detailed information which contains what I need to know to solve the problem e.g. StatusCode, StatusDescription and ResponseUri
My question is how can I access these values from my code when not running in debugger as the obvious ex.InnerException.Response.StatusCode doesn't work as "Response is not a member of Exception" despite it appearing as so in debugger