Throw with ParamName=value instead of Encoding (#38820)
authorYoussef Victor <31348972+Youssef1313@users.noreply.github.com>
Wed, 8 Jul 2020 17:54:54 +0000 (19:54 +0200)
committerGitHub <noreply@github.com>
Wed, 8 Jul 2020 17:54:54 +0000 (10:54 -0700)
* Throw with ParamName=value instead of Encoding

* Update WebClientTest.cs

src/libraries/System.Net.WebClient/src/System/Net/WebClient.cs
src/libraries/System.Net.WebClient/tests/WebClientTest.cs

index 9a8cfe6..129368a 100644 (file)
@@ -143,7 +143,7 @@ namespace System.Net
             get { return _encoding; }
             set
             {
-                ThrowIfNull(value, nameof(Encoding));
+                ThrowIfNull(value, nameof(value));
                 _encoding = value;
             }
         }
index 864a46b..b727562 100644 (file)
@@ -42,7 +42,7 @@ namespace System.Net.Tests
             var wc = new WebClient();
 
             AssertExtensions.Throws<ArgumentException>("value", () => { wc.BaseAddress = "http::/invalid url"; });
-            AssertExtensions.Throws<ArgumentNullException>("Encoding", () => { wc.Encoding = null; });
+            AssertExtensions.Throws<ArgumentNullException>("value", () => { wc.Encoding = null; });
         }
 
         [Fact]