diff options
author | Viktor Hofer <viktor.hofer@microsoft.com> | 2017-10-27 19:00:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-27 19:00:52 +0300 |
commit | e3f74deb999571d3f34a6b2b8011caebcf06dbfc (patch) | |
tree | f7704e86cab9bf069e0fd474db944079496a4b83 /src/System.ComponentModel.TypeConverter | |
parent | b7b34392afa430caf03d197789a493fd122db445 (diff) |
Make corefx exceptions serializable and add typeforwards (#24427)
* Add serializable attribute and typeforward and adding serialization impl
* Expose ZLibException in impl assembly
* Remove deserialization negative tests
* Adding tests for exceptions
* Adding SqlError data to base exception data table
* System Data Facade
* Add netfx471 blob diffs for Hashtable and ListDictionary
* Build Microsoft.NETCore.App.deps.json after manual shims
* Disable currently failing uap/uapaot tests because of shim assembly load errors
Diffstat (limited to 'src/System.ComponentModel.TypeConverter')
4 files changed, 14 insertions, 7 deletions
diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs index 6490279d60..c3529cc1d1 100644 --- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs +++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/Design/CheckoutException.cs @@ -18,6 +18,8 @@ namespace System.ComponentModel.Design /// a source control program. /// </para> /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class CheckoutException : ExternalException { private const int E_ABORT = unchecked((int)0x80004004); @@ -70,7 +72,6 @@ namespace System.ComponentModel.Design /// </summary> protected CheckoutException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } /// <summary> diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs index df9ab63f95..19c17dd642 100644 --- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs +++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/InvalidAsynchronousStateException.cs @@ -9,6 +9,8 @@ namespace System.ComponentModel /// <summary> /// <para>The exception that is thrown when a thread that an operation should execute on no longer exists or is not pumping messages</para> /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class InvalidAsynchronousStateException : ArgumentException { /// <summary> @@ -38,7 +40,6 @@ namespace System.ComponentModel protected InvalidAsynchronousStateException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs index 2c8ffecf85..966f63fc3f 100644 --- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs +++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/LicenseException.cs @@ -13,6 +13,8 @@ namespace System.ComponentModel /// <summary> /// <para>Represents the exception thrown when a component cannot be granted a license.</para> /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors")] // must not, a Type is required in all constructors. public class LicenseException : SystemException { @@ -58,7 +60,6 @@ namespace System.ComponentModel /// </summary> protected LicenseException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } /// <summary> @@ -72,6 +73,8 @@ namespace System.ComponentModel public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("type", null); // Type is not serializable. + info.AddValue("instance", _instance); } } } diff --git a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs index f15a1d8ac8..5636cb8b2a 100644 --- a/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs +++ b/src/System.ComponentModel.TypeConverter/src/System/ComponentModel/WarningException.cs @@ -14,6 +14,8 @@ namespace System.ComponentModel /// <summary> /// <para>Specifies an exception that is handled as a warning instead of an error.</para> /// </summary> + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class WarningException : SystemException { /// <summary> @@ -66,7 +68,8 @@ namespace System.ComponentModel /// </summary> protected WarningException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + HelpUrl = (string)info.GetValue("helpUrl", typeof(string)); + HelpTopic = (string)info.GetValue("helpTopic", typeof(string)); } /// <summary> @@ -81,12 +84,11 @@ namespace System.ComponentModel /// </summary> public string HelpTopic { get; } - /// <summary> - /// Need this since Exception implements ISerializable. - /// </summary> public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("helpUrl", HelpUrl); + info.AddValue("helpTopic", HelpTopic); } } } |