[WindowsBase] Fix exception type in *ValueSerializer.ConvertFromString with null...
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 18 Sep 2017 19:14:22 +0000 (21:14 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 19 Sep 2017 08:58:58 +0000 (10:58 +0200)
ArgumentNullException was introduced by https://github.com/mono/mono/pull/5593
but it should be NotSupportedException instead to match with Windows .NET.

Similar change to what was noticed during review of https://github.com/mono/mono/pull/5343#discussion_r132166426.

mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs
mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs
mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs
mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs
mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs
mcs/class/WindowsBase/Test/System.Windows/Int32RectValueSerializerTest.cs
mcs/class/WindowsBase/Test/System.Windows/PointValueSerializerTest.cs
mcs/class/WindowsBase/Test/System.Windows/RectValueSerializerTest.cs
mcs/class/WindowsBase/Test/System.Windows/SizeValueSerializerTest.cs
mcs/class/WindowsBase/Test/System.Windows/VectorValueSerializerTest.cs

index 0f59ec563aad5945c5548a74b8bda45780696334..acaa7b2852a9a32556a45e55886f5e1a426795c3 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Windows.Converters {
                public override object ConvertFromString (string value, IValueSerializerContext context)
                {
                        if (value == null)
-                               throw new ArgumentNullException ("value");
+                               throw new NotSupportedException ("value != null");
                        return Int32Rect.Parse (value);
                }
 
index 2e0b0cd3d0fd229c74e54a2ff5958ec8b307d956..150c2e8304cd8b2ca2a54e135f3a9fa05b1a77de 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Windows.Converters {
                public override object ConvertFromString (string value, IValueSerializerContext context)
                {
                        if (value == null)
-                               throw new ArgumentNullException ("value");
+                               throw new NotSupportedException ("value != null");
                        return Point.Parse (value);
                }
 
index 24b4c3d60bc97f5b52cd0abba15acd759eaaffab..623c0d688bb1ad969dabf21ff18341ca01456f34 100644 (file)
@@ -42,7 +42,7 @@ namespace System.Windows.Converters {
                public override object ConvertFromString (string value, IValueSerializerContext context)
                {
                        if (value == null)
-                               throw new ArgumentNullException ("value");
+                               throw new NotSupportedException ("value != null");
                        return Rect.Parse (value);
                }
 
index 0a46f1d1e9710cbe798a64e28df4027daddc73a6..2765b7397f80ef7de361872ebad9acbc3ed2d87d 100644 (file)
@@ -45,7 +45,7 @@ namespace System.Windows.Converters {
                public override object ConvertFromString (string value, IValueSerializerContext context)
                {
                        if (value == null)
-                               throw new ArgumentNullException ("value");
+                               throw new NotSupportedException ("value != null");
                        return Size.Parse (value);
                }
 
index 376e4dc21ce77549e45bfb427bee97ff7726ab24..6ec7ae6f5899c86be5ff97dd25a8c39516fb61fb 100644 (file)
@@ -43,7 +43,7 @@ namespace System.Windows.Converters {
                public override object ConvertFromString (string value, IValueSerializerContext context)
                {
                        if (value == null)
-                               throw new ArgumentNullException ("value");
+                               throw new NotSupportedException ("value != null");
                        return Vector.Parse (value);
                }
 
index 86c2fbd232779a1ec27c51bf5893b8c716c2a35a..222b35c1aa0d0307980be863b6f45dea186ca4af 100644 (file)
@@ -50,7 +50,7 @@ namespace MonoTests.System.Windows {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
                {
                        var serializer = new Int32RectValueSerializer ();
index a9687d49d990861dbec0dfae71e73e4b28cf6157..679cd74277b36e47c208e01b5f032581876123b8 100644 (file)
@@ -50,7 +50,7 @@ namespace MonoTests.System.Windows {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
                {
                        var serializer = new PointValueSerializer ();
index 41d6d83e9b5d4ffd4202505483cea504fb5413b1..3a549c3d12171eea977d6eebd47c0f5a28c13de8 100644 (file)
@@ -50,7 +50,7 @@ namespace MonoTests.System.Windows {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
                {
                        var serializer = new RectValueSerializer ();
index 003e9fc0505f5487032772b4dfd28068d71ff3f9..368085d00cf45b4c73ea4660a6a3b29ce911c392 100644 (file)
@@ -50,7 +50,7 @@ namespace MonoTests.System.Windows {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
                {
                        var serializer = new SizeValueSerializer ();
index 80446687205fcadf35acf0cbfd67c3afc48c698e..3b79a996741f19dac1f34722991ef2740898fb0e 100644 (file)
@@ -50,7 +50,7 @@ namespace MonoTests.System.Windows {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
+               [ExpectedException (typeof (NotSupportedException))]
                public void ConvertFromStringShouldThrowExceptionWhenStringIsNull ()
                {
                        var serializer = new VectorValueSerializer ();