From: Alexander Köplinger Date: Mon, 18 Sep 2017 19:14:22 +0000 (+0200) Subject: [WindowsBase] Fix exception type in *ValueSerializer.ConvertFromString with null... X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mono.git;a=commitdiff_plain;h=8d17a32927dbc31206b15e4e022f02c54d88ee4f [WindowsBase] Fix exception type in *ValueSerializer.ConvertFromString with null parameter 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. --- diff --git a/mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs index 0f59ec563aa..acaa7b2852a 100644 --- a/mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs +++ b/mcs/class/WindowsBase/System.Windows.Converters/Int32RectValueSerializer.cs @@ -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); } diff --git a/mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs index 2e0b0cd3d0f..150c2e8304c 100644 --- a/mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs +++ b/mcs/class/WindowsBase/System.Windows.Converters/PointValueSerializer.cs @@ -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); } diff --git a/mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs index 24b4c3d60bc..623c0d688bb 100644 --- a/mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs +++ b/mcs/class/WindowsBase/System.Windows.Converters/RectValueSerializer.cs @@ -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); } diff --git a/mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs index 0a46f1d1e97..2765b7397f8 100644 --- a/mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs +++ b/mcs/class/WindowsBase/System.Windows.Converters/SizeValueSerializer.cs @@ -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); } diff --git a/mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs b/mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs index 376e4dc21ce..6ec7ae6f589 100644 --- a/mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs +++ b/mcs/class/WindowsBase/System.Windows.Converters/VectorValueSerializer.cs @@ -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); } diff --git a/mcs/class/WindowsBase/Test/System.Windows/Int32RectValueSerializerTest.cs b/mcs/class/WindowsBase/Test/System.Windows/Int32RectValueSerializerTest.cs index 86c2fbd2327..222b35c1aa0 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/Int32RectValueSerializerTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/Int32RectValueSerializerTest.cs @@ -50,7 +50,7 @@ namespace MonoTests.System.Windows { } [Test] - [ExpectedException (typeof (ArgumentNullException))] + [ExpectedException (typeof (NotSupportedException))] public void ConvertFromStringShouldThrowExceptionWhenStringIsNull () { var serializer = new Int32RectValueSerializer (); diff --git a/mcs/class/WindowsBase/Test/System.Windows/PointValueSerializerTest.cs b/mcs/class/WindowsBase/Test/System.Windows/PointValueSerializerTest.cs index a9687d49d99..679cd74277b 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/PointValueSerializerTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/PointValueSerializerTest.cs @@ -50,7 +50,7 @@ namespace MonoTests.System.Windows { } [Test] - [ExpectedException (typeof (ArgumentNullException))] + [ExpectedException (typeof (NotSupportedException))] public void ConvertFromStringShouldThrowExceptionWhenStringIsNull () { var serializer = new PointValueSerializer (); diff --git a/mcs/class/WindowsBase/Test/System.Windows/RectValueSerializerTest.cs b/mcs/class/WindowsBase/Test/System.Windows/RectValueSerializerTest.cs index 41d6d83e9b5..3a549c3d121 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/RectValueSerializerTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/RectValueSerializerTest.cs @@ -50,7 +50,7 @@ namespace MonoTests.System.Windows { } [Test] - [ExpectedException (typeof (ArgumentNullException))] + [ExpectedException (typeof (NotSupportedException))] public void ConvertFromStringShouldThrowExceptionWhenStringIsNull () { var serializer = new RectValueSerializer (); diff --git a/mcs/class/WindowsBase/Test/System.Windows/SizeValueSerializerTest.cs b/mcs/class/WindowsBase/Test/System.Windows/SizeValueSerializerTest.cs index 003e9fc0505..368085d00cf 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/SizeValueSerializerTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/SizeValueSerializerTest.cs @@ -50,7 +50,7 @@ namespace MonoTests.System.Windows { } [Test] - [ExpectedException (typeof (ArgumentNullException))] + [ExpectedException (typeof (NotSupportedException))] public void ConvertFromStringShouldThrowExceptionWhenStringIsNull () { var serializer = new SizeValueSerializer (); diff --git a/mcs/class/WindowsBase/Test/System.Windows/VectorValueSerializerTest.cs b/mcs/class/WindowsBase/Test/System.Windows/VectorValueSerializerTest.cs index 80446687205..3b79a996741 100644 --- a/mcs/class/WindowsBase/Test/System.Windows/VectorValueSerializerTest.cs +++ b/mcs/class/WindowsBase/Test/System.Windows/VectorValueSerializerTest.cs @@ -50,7 +50,7 @@ namespace MonoTests.System.Windows { } [Test] - [ExpectedException (typeof (ArgumentNullException))] + [ExpectedException (typeof (NotSupportedException))] public void ConvertFromStringShouldThrowExceptionWhenStringIsNull () { var serializer = new VectorValueSerializer ();