[System] EndRead now throws WebException on abort.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Thu, 7 Jul 2016 15:39:21 +0000 (16:39 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 8 Jul 2016 13:42:52 +0000 (14:42 +0100)
When a requast is aborted on .NET a WebException is thrown and not a
ObjectDisposedException as we were doing.

Fixes #41477

mcs/class/System/System.Net/WebConnection.cs

index 28d89a6065cd04a62b2827062409bd9fe057de06..5178569f3c253e058238876545bddbc2d00b75dc 100644 (file)
@@ -896,6 +896,8 @@ namespace System.Net
                {
                        Stream s = null;
                        lock (this) {
+                               if (request.Aborted)
+                                       throw new WebException ("Request aborted", WebExceptionStatus.RequestCanceled);
                                if (Data.request != request)
                                        throw new ObjectDisposedException (typeof (NetworkStream).FullName);
                                if (nstream == null)