Closed edwardgoran closed 4 years ago
Interesting, .NET Core's WebRequest
implementation has different behavior than .NET Framework's which throws System.Net.WebException : The remote name could not be resolved
, with this fix, .NET Core now also throws System.Net.WebException : No such host is known No such host is known
.
This change is available from the latest v5.8.1 that's now available on MyGet.
thx for reporting!
Hi, when sending PostFilesWithRequest that will fail and cause an exception, System.IndexOutOfRangeException hides the real exception. I.e. the URL may not exist or the server is not online.
This issue is reproducable. A code snippet below illustrates this.
System.IndexOutOfRangeException: 'Index was outside the bounds of the array.' This exception was originally thrown at this call stack: ServiceStack.ServiceClientBase.PostFilesWithRequest(string, object, ServiceStack.UploadFile[])
ServiceStack.ServiceClientBase.PostFilesWithRequest(string, object, System.Collections.Generic.IEnumerable) in ServiceClientBase.cs
PostFilesWithRequestError.Program.Main(string[]) in Program.cs
Found in ServiceStack 5.5.0 Replicated in ServiceStack 5.8.0 .NET framework version 4.7.2
The problem appears to be in: https://github.com/ServiceStack/ServiceStack/blob/eb19fd4877ce08dc1390dfcdf3a11921210393b5/src/ServiceStack.Client/ServiceClientBase.cs#L1700
Thanks.