From 7ac9415c0503c4257fa78b4eb9f6890a7becb37d Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 3 Oct 2017 22:11:09 +0200 Subject: [PATCH] Make coreclr exceptions serializable and add typeforwards --- .../shared/System/AccessViolationException.cs | 3 ++- src/mscorlib/shared/System/ApplicationException.cs | 4 ++-- src/mscorlib/shared/System/ArgumentException.cs | 6 ++++-- src/mscorlib/shared/System/ArgumentNullException.cs | 4 ++-- .../shared/System/ArgumentOutOfRangeException.cs | 7 +++++-- src/mscorlib/shared/System/ArithmeticException.cs | 4 ++-- .../shared/System/ArrayTypeMismatchException.cs | 4 ++-- src/mscorlib/shared/System/BadImageFormatException.cs | 7 ++++++- .../Collections/Generic/KeyNotFoundException.cs | 3 ++- src/mscorlib/shared/System/DataMisalignedException.cs | 6 ++++++ src/mscorlib/shared/System/DivideByZeroException.cs | 3 ++- src/mscorlib/shared/System/DllNotFoundException.cs | 3 ++- .../shared/System/DuplicateWaitObjectException.cs | 4 ++-- .../shared/System/EntryPointNotFoundException.cs | 3 ++- .../shared/System/ExecutionEngineException.cs | 6 ++++++ src/mscorlib/shared/System/FieldAccessException.cs | 3 ++- src/mscorlib/shared/System/FormatException.cs | 3 ++- .../System/Globalization/CultureNotFoundException.cs | 7 ++++++- .../shared/System/IO/DirectoryNotFoundException.cs | 3 ++- .../shared/System/IO/DriveNotFoundException.cs | 3 ++- src/mscorlib/shared/System/IO/EndOfStreamException.cs | 3 ++- src/mscorlib/shared/System/IO/FileLoadException.cs | 7 ++++++- .../shared/System/IO/FileNotFoundException.cs | 7 ++++++- src/mscorlib/shared/System/IO/IOException.cs | 3 ++- src/mscorlib/shared/System/IO/PathTooLongException.cs | 3 ++- .../shared/System/IndexOutOfRangeException.cs | 6 ++++++ .../System/InsufficientExecutionStackException.cs | 6 ++++++ src/mscorlib/shared/System/InvalidCastException.cs | 3 ++- .../shared/System/InvalidOperationException.cs | 3 ++- src/mscorlib/shared/System/InvalidProgramException.cs | 4 ++++ .../shared/System/InvalidTimeZoneException.cs | 3 ++- src/mscorlib/shared/System/MemberAccessException.cs | 4 ++-- src/mscorlib/shared/System/MethodAccessException.cs | 3 ++- src/mscorlib/shared/System/MissingMethodException.cs | 3 ++- .../shared/System/MulticastNotSupportedException.cs | 6 ++++++ .../shared/System/NotFiniteNumberException.cs | 5 ++++- src/mscorlib/shared/System/NotImplementedException.cs | 3 ++- src/mscorlib/shared/System/NotSupportedException.cs | 3 ++- src/mscorlib/shared/System/NullReferenceException.cs | 3 ++- src/mscorlib/shared/System/ObjectDisposedException.cs | 5 ++++- .../shared/System/OperationCanceledException.cs | 3 ++- src/mscorlib/shared/System/OverflowException.cs | 3 ++- .../shared/System/PlatformNotSupportedException.cs | 3 ++- src/mscorlib/shared/System/RankException.cs | 3 ++- .../System/Reflection/AmbiguousMatchException.cs | 6 ++++++ .../Reflection/CustomAttributeFormatException.cs | 3 ++- .../Reflection/InvalidFilterCriteriaException.cs | 3 ++- .../shared/System/Reflection/TargetException.cs | 3 ++- .../System/Reflection/TargetInvocationException.cs | 7 +++++++ .../Reflection/TargetParameterCountException.cs | 7 +++++++ .../Resources/MissingManifestResourceException.cs | 3 ++- .../Resources/MissingSatelliteAssemblyException.cs | 3 ++- .../CompilerServices/RuntimeWrappedException.cs | 15 +++++++++++++++ .../Runtime/InteropServices/ExternalException.cs | 4 ++-- .../Runtime/Serialization/SerializationException.cs | 3 ++- .../shared/System/Security/CryptographicException.cs | 3 ++- .../shared/System/Security/SecurityException.cs | 3 ++- .../shared/System/Security/VerificationException.cs | 3 ++- src/mscorlib/shared/System/StackOverflowException.cs | 6 ++++++ src/mscorlib/shared/System/SystemException.cs | 3 ++- .../System/Threading/AbandonedMutexException.cs | 3 ++- .../shared/System/Threading/LockRecursionException.cs | 3 ++- .../shared/System/Threading/SemaphoreFullException.cs | 3 ++- .../System/Threading/SynchronizationLockException.cs | 3 ++- .../System/Threading/Tasks/TaskCanceledException.cs | 3 ++- .../System/Threading/Tasks/TaskSchedulerException.cs | 3 ++- .../shared/System/Threading/ThreadAbortException.cs | 7 +++++++ .../shared/System/Threading/ThreadStartException.cs | 7 +++++++ .../shared/System/Threading/ThreadStateException.cs | 3 ++- .../Threading/WaitHandleCannotBeOpenedException.cs | 3 ++- .../shared/System/TimeZoneNotFoundException.cs | 3 ++- src/mscorlib/shared/System/TimeoutException.cs | 3 ++- src/mscorlib/shared/System/TypeAccessException.cs | 3 ++- .../shared/System/TypeInitializationException.cs | 9 +++++++++ src/mscorlib/shared/System/TypeUnloadedException.cs | 3 ++- .../shared/System/UnauthorizedAccessException.cs | 5 +++-- src/mscorlib/src/System/AppDomainUnloadedException.cs | 6 ++---- .../src/System/InsufficientMemoryException.cs | 6 ++++++ src/mscorlib/src/System/MissingFieldException.cs | 3 ++- src/mscorlib/src/System/MissingMemberException.cs | 14 +++++++++++++- src/mscorlib/src/System/OutOfMemoryException.cs | 3 ++- .../System/Runtime/InteropServices/COMException.cs | 4 ++-- .../InteropServices/InvalidComObjectException.cs | 3 ++- .../InteropServices/InvalidOleVariantTypeException.cs | 3 ++- .../InteropServices/MarshalDirectiveException.cs | 3 ++- .../System/Runtime/InteropServices/SEHException.cs | 4 ++-- .../InteropServices/SafeArrayRankMismatchException.cs | 3 ++- .../InteropServices/SafeArrayTypeMismatchException.cs | 3 ++- .../System/Threading/ThreadInterruptedException.cs | 3 ++- src/mscorlib/src/System/TypeLoadException.cs | 19 ++++++++++++++++++- 90 files changed, 307 insertions(+), 90 deletions(-) diff --git a/src/mscorlib/shared/System/AccessViolationException.cs b/src/mscorlib/shared/System/AccessViolationException.cs index 103a4c0..280d9b8 100644 --- a/src/mscorlib/shared/System/AccessViolationException.cs +++ b/src/mscorlib/shared/System/AccessViolationException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class AccessViolationException : SystemException { public AccessViolationException() @@ -38,7 +40,6 @@ namespace System protected AccessViolationException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } #pragma warning disable 169 // Field is not used from managed. diff --git a/src/mscorlib/shared/System/ApplicationException.cs b/src/mscorlib/shared/System/ApplicationException.cs index 83ced79..f36e2c1 100644 --- a/src/mscorlib/shared/System/ApplicationException.cs +++ b/src/mscorlib/shared/System/ApplicationException.cs @@ -22,7 +22,8 @@ namespace System // to create their own exceptions do so by extending this class. // ApplicationException extends but adds no new functionality to // RecoverableException. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ApplicationException : Exception { // Creates a new ApplicationException with its message string set to @@ -52,7 +53,6 @@ namespace System protected ApplicationException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/ArgumentException.cs b/src/mscorlib/shared/System/ArgumentException.cs index fe65d64..8a8fe3e 100644 --- a/src/mscorlib/shared/System/ArgumentException.cs +++ b/src/mscorlib/shared/System/ArgumentException.cs @@ -19,7 +19,8 @@ namespace System // The ArgumentException is thrown when an argument does not meet // the contract of the method. Ideally it should give a meaningful error // message describing what was wrong and which parameter is incorrect. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ArgumentException : SystemException { private String _paramName; @@ -64,12 +65,13 @@ namespace System protected ArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + _paramName = info.GetString("ParamName"); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("ParamName", _paramName, typeof(string)); } public override String Message diff --git a/src/mscorlib/shared/System/ArgumentNullException.cs b/src/mscorlib/shared/System/ArgumentNullException.cs index 9b0732b..80e43cc 100644 --- a/src/mscorlib/shared/System/ArgumentNullException.cs +++ b/src/mscorlib/shared/System/ArgumentNullException.cs @@ -17,7 +17,8 @@ namespace System { // The ArgumentException is thrown when an argument // is null when it shouldn't be. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ArgumentNullException : ArgumentException { // Creates a new ArgumentNullException with its message @@ -49,7 +50,6 @@ namespace System protected ArgumentNullException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/ArgumentOutOfRangeException.cs b/src/mscorlib/shared/System/ArgumentOutOfRangeException.cs index a25cd57..604caa8 100644 --- a/src/mscorlib/shared/System/ArgumentOutOfRangeException.cs +++ b/src/mscorlib/shared/System/ArgumentOutOfRangeException.cs @@ -17,7 +17,9 @@ using System.Runtime.Serialization; namespace System { // The ArgumentOutOfRangeException is thrown when an argument - // is outside the legal range for that argument. + // is outside the legal range for that argument. + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ArgumentOutOfRangeException : ArgumentException { private Object _actualValue; @@ -61,12 +63,13 @@ namespace System protected ArgumentOutOfRangeException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + _actualValue = info.GetValue("ActualValue", typeof(object)); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("ActualValue", _actualValue, typeof(object)); } public override String Message diff --git a/src/mscorlib/shared/System/ArithmeticException.cs b/src/mscorlib/shared/System/ArithmeticException.cs index 6285c81..606f1de 100644 --- a/src/mscorlib/shared/System/ArithmeticException.cs +++ b/src/mscorlib/shared/System/ArithmeticException.cs @@ -17,7 +17,8 @@ namespace System { // The ArithmeticException is thrown when overflow or underflow // occurs. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ArithmeticException : SystemException { // Creates a new ArithmeticException with its message string set to @@ -47,7 +48,6 @@ namespace System protected ArithmeticException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/ArrayTypeMismatchException.cs b/src/mscorlib/shared/System/ArrayTypeMismatchException.cs index 6964b1f..49820f5 100644 --- a/src/mscorlib/shared/System/ArrayTypeMismatchException.cs +++ b/src/mscorlib/shared/System/ArrayTypeMismatchException.cs @@ -17,7 +17,8 @@ namespace System { // The ArrayMismatchException is thrown when an attempt to store // an object of the wrong type within an array occurs. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ArrayTypeMismatchException : SystemException { // Creates a new ArrayMismatchException with its message string set to @@ -47,7 +48,6 @@ namespace System protected ArrayTypeMismatchException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/BadImageFormatException.cs b/src/mscorlib/shared/System/BadImageFormatException.cs index a4661fc..1743075 100644 --- a/src/mscorlib/shared/System/BadImageFormatException.cs +++ b/src/mscorlib/shared/System/BadImageFormatException.cs @@ -17,6 +17,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public partial class BadImageFormatException : SystemException { private String _fileName; // The name of the corrupt PE file. @@ -56,12 +58,15 @@ namespace System protected BadImageFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + _fileName = info.GetString("BadImageFormat_FileName"); + _fusionLog = info.GetString("BadImageFormat_FusionLog"); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("BadImageFormat_FileName", _fileName, typeof(string)); + info.AddValue("BadImageFormat_FusionLog", _fusionLog, typeof(string)); } public override String Message diff --git a/src/mscorlib/shared/System/Collections/Generic/KeyNotFoundException.cs b/src/mscorlib/shared/System/Collections/Generic/KeyNotFoundException.cs index c32bc62..48eddb8 100644 --- a/src/mscorlib/shared/System/Collections/Generic/KeyNotFoundException.cs +++ b/src/mscorlib/shared/System/Collections/Generic/KeyNotFoundException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.Collections.Generic { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class KeyNotFoundException : SystemException { public KeyNotFoundException() @@ -29,7 +31,6 @@ namespace System.Collections.Generic protected KeyNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/DataMisalignedException.cs b/src/mscorlib/shared/System/DataMisalignedException.cs index d8d36b5..2a245b6 100644 --- a/src/mscorlib/shared/System/DataMisalignedException.cs +++ b/src/mscorlib/shared/System/DataMisalignedException.cs @@ -13,6 +13,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class DataMisalignedException : SystemException { public DataMisalignedException() @@ -32,5 +34,9 @@ namespace System { HResult = HResults.COR_E_DATAMISALIGNED; } + + internal DataMisalignedException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/DivideByZeroException.cs b/src/mscorlib/shared/System/DivideByZeroException.cs index ad74bde..b309695 100644 --- a/src/mscorlib/shared/System/DivideByZeroException.cs +++ b/src/mscorlib/shared/System/DivideByZeroException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class DivideByZeroException : ArithmeticException { public DivideByZeroException() @@ -37,7 +39,6 @@ namespace System protected DivideByZeroException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/DllNotFoundException.cs b/src/mscorlib/shared/System/DllNotFoundException.cs index 82d5bdd..14fb50d 100644 --- a/src/mscorlib/shared/System/DllNotFoundException.cs +++ b/src/mscorlib/shared/System/DllNotFoundException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class DllNotFoundException : TypeLoadException { public DllNotFoundException() @@ -38,7 +40,6 @@ namespace System protected DllNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/DuplicateWaitObjectException.cs b/src/mscorlib/shared/System/DuplicateWaitObjectException.cs index 95bdedd..7730384 100644 --- a/src/mscorlib/shared/System/DuplicateWaitObjectException.cs +++ b/src/mscorlib/shared/System/DuplicateWaitObjectException.cs @@ -17,7 +17,8 @@ namespace System { // The DuplicateWaitObjectException is thrown when an object // appears more than once in the list of objects to WaitAll or WaitAny. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class DuplicateWaitObjectException : ArgumentException { private static volatile String s_duplicateWaitObjectMessage = null; @@ -60,7 +61,6 @@ namespace System protected DuplicateWaitObjectException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/EntryPointNotFoundException.cs b/src/mscorlib/shared/System/EntryPointNotFoundException.cs index e62ca0e..dac1cdb 100644 --- a/src/mscorlib/shared/System/EntryPointNotFoundException.cs +++ b/src/mscorlib/shared/System/EntryPointNotFoundException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class EntryPointNotFoundException : TypeLoadException { public EntryPointNotFoundException() @@ -38,7 +40,6 @@ namespace System protected EntryPointNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/ExecutionEngineException.cs b/src/mscorlib/shared/System/ExecutionEngineException.cs index c334358..5edd5cf 100644 --- a/src/mscorlib/shared/System/ExecutionEngineException.cs +++ b/src/mscorlib/shared/System/ExecutionEngineException.cs @@ -21,6 +21,8 @@ using System.Runtime.Serialization; namespace System { [Obsolete("This type previously indicated an unspecified fatal error in the runtime. The runtime no longer raises this exception so this type is obsolete.")] + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class ExecutionEngineException : SystemException { public ExecutionEngineException() @@ -40,5 +42,9 @@ namespace System { HResult = HResults.COR_E_EXECUTIONENGINE; } + + internal ExecutionEngineException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/FieldAccessException.cs b/src/mscorlib/shared/System/FieldAccessException.cs index 883bbd8..cb28264 100644 --- a/src/mscorlib/shared/System/FieldAccessException.cs +++ b/src/mscorlib/shared/System/FieldAccessException.cs @@ -13,6 +13,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class FieldAccessException : MemberAccessException { public FieldAccessException() @@ -35,7 +37,6 @@ namespace System protected FieldAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/FormatException.cs b/src/mscorlib/shared/System/FormatException.cs index 4af45cd..b0e2733 100644 --- a/src/mscorlib/shared/System/FormatException.cs +++ b/src/mscorlib/shared/System/FormatException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class FormatException : SystemException { public FormatException() @@ -37,7 +39,6 @@ namespace System protected FormatException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs b/src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs index dde1a8b..10e8b1f 100644 --- a/src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs +++ b/src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Globalization { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class CultureNotFoundException : ArgumentException { private string _invalidCultureName; // unrecognized culture name @@ -58,12 +60,15 @@ namespace System.Globalization protected CultureNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + _invalidCultureId = (int?)info.GetValue("InvalidCultureId", typeof(int?)); + _invalidCultureName = (string)info.GetValue("InvalidCultureName", typeof(string)); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("InvalidCultureId", _invalidCultureId, typeof(int?)); + info.AddValue("InvalidCultureName", _invalidCultureName, typeof(string)); } public virtual Nullable InvalidCultureId diff --git a/src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs b/src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs index 87e610b..d7c6eac 100644 --- a/src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs +++ b/src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs @@ -12,6 +12,8 @@ namespace System.IO * the Win32 errorcode-as-HRESULT ERROR_PATH_NOT_FOUND (0x80070003) * and STG_E_PATHNOTFOUND (0x80030003). */ + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class DirectoryNotFoundException : IOException { public DirectoryNotFoundException() @@ -35,7 +37,6 @@ namespace System.IO protected DirectoryNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/IO/DriveNotFoundException.cs b/src/mscorlib/shared/System/IO/DriveNotFoundException.cs index c0f8c55..3f2c88c 100644 --- a/src/mscorlib/shared/System/IO/DriveNotFoundException.cs +++ b/src/mscorlib/shared/System/IO/DriveNotFoundException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.IO { //Thrown when trying to access a drive that is not available. + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] internal class DriveNotFoundException : IOException { public DriveNotFoundException() @@ -29,7 +31,6 @@ namespace System.IO protected DriveNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/IO/EndOfStreamException.cs b/src/mscorlib/shared/System/IO/EndOfStreamException.cs index ee37818..606073a 100644 --- a/src/mscorlib/shared/System/IO/EndOfStreamException.cs +++ b/src/mscorlib/shared/System/IO/EndOfStreamException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.IO { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class EndOfStreamException : IOException { public EndOfStreamException() @@ -29,7 +31,6 @@ namespace System.IO protected EndOfStreamException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/IO/FileLoadException.cs b/src/mscorlib/shared/System/IO/FileLoadException.cs index b126424..8c31244 100644 --- a/src/mscorlib/shared/System/IO/FileLoadException.cs +++ b/src/mscorlib/shared/System/IO/FileLoadException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.IO { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public partial class FileLoadException : IOException { public FileLoadException() @@ -82,12 +84,15 @@ namespace System.IO protected FileLoadException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + FileName = info.GetString("FileLoad_FileName"); + FusionLog = info.GetString("FileLoad_FusionLog"); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("FileLoad_FileName", FileName, typeof(string)); + info.AddValue("FileLoad_FusionLog", FusionLog, typeof(string)); } } } diff --git a/src/mscorlib/shared/System/IO/FileNotFoundException.cs b/src/mscorlib/shared/System/IO/FileNotFoundException.cs index dc1ccf5..72cff4c 100644 --- a/src/mscorlib/shared/System/IO/FileNotFoundException.cs +++ b/src/mscorlib/shared/System/IO/FileNotFoundException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.IO { // Thrown when trying to access a file that doesn't exist on disk. + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public partial class FileNotFoundException : IOException { public FileNotFoundException() @@ -93,12 +95,15 @@ namespace System.IO protected FileNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + FileName = info.GetString("FileNotFound_FileName"); + FusionLog = info.GetString("FileNotFound_FusionLog"); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("FileNotFound_FileName", FileName, typeof(string)); + info.AddValue("FileNotFound_FusionLog", FusionLog, typeof(string)); } } } diff --git a/src/mscorlib/shared/System/IO/IOException.cs b/src/mscorlib/shared/System/IO/IOException.cs index 1fbd352..89b25d5 100644 --- a/src/mscorlib/shared/System/IO/IOException.cs +++ b/src/mscorlib/shared/System/IO/IOException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.IO { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class IOException : SystemException { public IOException() @@ -35,7 +37,6 @@ namespace System.IO protected IOException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/IO/PathTooLongException.cs b/src/mscorlib/shared/System/IO/PathTooLongException.cs index 15f282e..7af2452 100644 --- a/src/mscorlib/shared/System/IO/PathTooLongException.cs +++ b/src/mscorlib/shared/System/IO/PathTooLongException.cs @@ -8,6 +8,8 @@ using System.Runtime.Serialization; namespace System.IO { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class PathTooLongException : IOException { public PathTooLongException() @@ -31,7 +33,6 @@ namespace System.IO protected PathTooLongException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/IndexOutOfRangeException.cs b/src/mscorlib/shared/System/IndexOutOfRangeException.cs index bec63d7..b6d93ef 100644 --- a/src/mscorlib/shared/System/IndexOutOfRangeException.cs +++ b/src/mscorlib/shared/System/IndexOutOfRangeException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class IndexOutOfRangeException : SystemException { public IndexOutOfRangeException() @@ -34,5 +36,9 @@ namespace System { HResult = HResults.COR_E_INDEXOUTOFRANGE; } + + internal IndexOutOfRangeException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/InsufficientExecutionStackException.cs b/src/mscorlib/shared/System/InsufficientExecutionStackException.cs index a14cb67..4822028 100644 --- a/src/mscorlib/shared/System/InsufficientExecutionStackException.cs +++ b/src/mscorlib/shared/System/InsufficientExecutionStackException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class InsufficientExecutionStackException : SystemException { public InsufficientExecutionStackException() @@ -25,5 +27,9 @@ namespace System { HResult = HResults.COR_E_INSUFFICIENTEXECUTIONSTACK; } + + internal InsufficientExecutionStackException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/InvalidCastException.cs b/src/mscorlib/shared/System/InvalidCastException.cs index 00b393c..0556432 100644 --- a/src/mscorlib/shared/System/InvalidCastException.cs +++ b/src/mscorlib/shared/System/InvalidCastException.cs @@ -12,6 +12,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class InvalidCastException : SystemException { public InvalidCastException() @@ -40,7 +42,6 @@ namespace System protected InvalidCastException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/InvalidOperationException.cs b/src/mscorlib/shared/System/InvalidOperationException.cs index 74a4ffd..62c222a 100644 --- a/src/mscorlib/shared/System/InvalidOperationException.cs +++ b/src/mscorlib/shared/System/InvalidOperationException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class InvalidOperationException : SystemException { public InvalidOperationException() @@ -38,7 +40,6 @@ namespace System protected InvalidOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/InvalidProgramException.cs b/src/mscorlib/shared/System/InvalidProgramException.cs index e352157..c8047c5 100644 --- a/src/mscorlib/shared/System/InvalidProgramException.cs +++ b/src/mscorlib/shared/System/InvalidProgramException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class InvalidProgramException : SystemException { public InvalidProgramException() @@ -34,5 +36,7 @@ namespace System { HResult = HResults.COR_E_INVALIDPROGRAM; } + + internal InvalidProgramException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/mscorlib/shared/System/InvalidTimeZoneException.cs b/src/mscorlib/shared/System/InvalidTimeZoneException.cs index 8b300f4..07450b0 100644 --- a/src/mscorlib/shared/System/InvalidTimeZoneException.cs +++ b/src/mscorlib/shared/System/InvalidTimeZoneException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class InvalidTimeZoneException : Exception { public InvalidTimeZoneException() @@ -24,7 +26,6 @@ namespace System protected InvalidTimeZoneException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/MemberAccessException.cs b/src/mscorlib/shared/System/MemberAccessException.cs index bb26d9e..dfea52d 100644 --- a/src/mscorlib/shared/System/MemberAccessException.cs +++ b/src/mscorlib/shared/System/MemberAccessException.cs @@ -14,7 +14,8 @@ namespace System { // The MemberAccessException is thrown when trying to access a class // member fails. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MemberAccessException : SystemException { // Creates a new MemberAccessException with its message string set to @@ -44,7 +45,6 @@ namespace System protected MemberAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/MethodAccessException.cs b/src/mscorlib/shared/System/MethodAccessException.cs index 1269138..1ca0297 100644 --- a/src/mscorlib/shared/System/MethodAccessException.cs +++ b/src/mscorlib/shared/System/MethodAccessException.cs @@ -13,6 +13,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MethodAccessException : MemberAccessException { public MethodAccessException() @@ -35,7 +37,6 @@ namespace System protected MethodAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/MissingMethodException.cs b/src/mscorlib/shared/System/MissingMethodException.cs index 4f5e8b6..abb6c0e 100644 --- a/src/mscorlib/shared/System/MissingMethodException.cs +++ b/src/mscorlib/shared/System/MissingMethodException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MissingMethodException : MissingMemberException { public MissingMethodException() @@ -44,7 +46,6 @@ namespace System protected MissingMethodException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } public override string Message diff --git a/src/mscorlib/shared/System/MulticastNotSupportedException.cs b/src/mscorlib/shared/System/MulticastNotSupportedException.cs index 56a3ec9..cc6c770 100644 --- a/src/mscorlib/shared/System/MulticastNotSupportedException.cs +++ b/src/mscorlib/shared/System/MulticastNotSupportedException.cs @@ -11,6 +11,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class MulticastNotSupportedException : SystemException { public MulticastNotSupportedException() @@ -30,5 +32,9 @@ namespace System { HResult = HResults.COR_E_MULTICASTNOTSUPPORTED; } + + internal MulticastNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/NotFiniteNumberException.cs b/src/mscorlib/shared/System/NotFiniteNumberException.cs index ca47a21..259248f 100644 --- a/src/mscorlib/shared/System/NotFiniteNumberException.cs +++ b/src/mscorlib/shared/System/NotFiniteNumberException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class NotFiniteNumberException : ArithmeticException { private double _offendingNumber; @@ -53,12 +55,13 @@ namespace System protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + _offendingNumber = info.GetInt32("OffendingNumber"); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("OffendingNumber", _offendingNumber, typeof(Int32)); } public double OffendingNumber diff --git a/src/mscorlib/shared/System/NotImplementedException.cs b/src/mscorlib/shared/System/NotImplementedException.cs index 98976c1..1a3b6af 100644 --- a/src/mscorlib/shared/System/NotImplementedException.cs +++ b/src/mscorlib/shared/System/NotImplementedException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class NotImplementedException : SystemException { public NotImplementedException() @@ -36,7 +38,6 @@ namespace System protected NotImplementedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/NotSupportedException.cs b/src/mscorlib/shared/System/NotSupportedException.cs index dc43261..3180bc2 100644 --- a/src/mscorlib/shared/System/NotSupportedException.cs +++ b/src/mscorlib/shared/System/NotSupportedException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class NotSupportedException : SystemException { public NotSupportedException() @@ -37,7 +39,6 @@ namespace System protected NotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/NullReferenceException.cs b/src/mscorlib/shared/System/NullReferenceException.cs index eb6d709..c2e7224 100644 --- a/src/mscorlib/shared/System/NullReferenceException.cs +++ b/src/mscorlib/shared/System/NullReferenceException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class NullReferenceException : SystemException { public NullReferenceException() @@ -37,7 +39,6 @@ namespace System protected NullReferenceException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/ObjectDisposedException.cs b/src/mscorlib/shared/System/ObjectDisposedException.cs index 3d7ba5d..be80c6d 100644 --- a/src/mscorlib/shared/System/ObjectDisposedException.cs +++ b/src/mscorlib/shared/System/ObjectDisposedException.cs @@ -11,6 +11,8 @@ namespace System /// The exception that is thrown when accessing an object that was /// disposed. /// + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ObjectDisposedException : InvalidOperationException { private String _objectName; @@ -41,12 +43,13 @@ namespace System protected ObjectDisposedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + _objectName = info.GetString("ObjectName"); } public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("ObjectName", ObjectName, typeof(string)); } /// diff --git a/src/mscorlib/shared/System/OperationCanceledException.cs b/src/mscorlib/shared/System/OperationCanceledException.cs index 44a0427..8a472c9 100644 --- a/src/mscorlib/shared/System/OperationCanceledException.cs +++ b/src/mscorlib/shared/System/OperationCanceledException.cs @@ -17,6 +17,8 @@ using System.Threading; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class OperationCanceledException : SystemException { [NonSerialized] @@ -67,7 +69,6 @@ namespace System protected OperationCanceledException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/OverflowException.cs b/src/mscorlib/shared/System/OverflowException.cs index bf6676c..963825b 100644 --- a/src/mscorlib/shared/System/OverflowException.cs +++ b/src/mscorlib/shared/System/OverflowException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class OverflowException : ArithmeticException { public OverflowException() @@ -37,7 +39,6 @@ namespace System protected OverflowException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/PlatformNotSupportedException.cs b/src/mscorlib/shared/System/PlatformNotSupportedException.cs index 4403c1d..5039f3f 100644 --- a/src/mscorlib/shared/System/PlatformNotSupportedException.cs +++ b/src/mscorlib/shared/System/PlatformNotSupportedException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class PlatformNotSupportedException : NotSupportedException { public PlatformNotSupportedException() @@ -37,7 +39,6 @@ namespace System protected PlatformNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/RankException.cs b/src/mscorlib/shared/System/RankException.cs index f2c5d06..bdd2cd5 100644 --- a/src/mscorlib/shared/System/RankException.cs +++ b/src/mscorlib/shared/System/RankException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class RankException : SystemException { public RankException() @@ -38,7 +40,6 @@ namespace System protected RankException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs b/src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs index c4aeca7..643a127 100644 --- a/src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs +++ b/src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Reflection { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class AmbiguousMatchException : SystemException { public AmbiguousMatchException() @@ -25,5 +27,9 @@ namespace System.Reflection { HResult = HResults.COR_E_AMBIGUOUSMATCH; } + + internal AmbiguousMatchException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs b/src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs index ae67158..1d7d4a7 100644 --- a/src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs +++ b/src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Reflection { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class CustomAttributeFormatException : FormatException { public CustomAttributeFormatException() @@ -27,7 +29,6 @@ namespace System.Reflection protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs b/src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs index 85a4477..dedcc54 100644 --- a/src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs +++ b/src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Reflection { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class InvalidFilterCriteriaException : ApplicationException { public InvalidFilterCriteriaException() @@ -27,7 +29,6 @@ namespace System.Reflection protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Reflection/TargetException.cs b/src/mscorlib/shared/System/Reflection/TargetException.cs index 2309daa..c200000 100644 --- a/src/mscorlib/shared/System/Reflection/TargetException.cs +++ b/src/mscorlib/shared/System/Reflection/TargetException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Reflection { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TargetException : ApplicationException { public TargetException() @@ -27,7 +29,6 @@ namespace System.Reflection protected TargetException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Reflection/TargetInvocationException.cs b/src/mscorlib/shared/System/Reflection/TargetInvocationException.cs index 7c4f60a..822ddfd 100644 --- a/src/mscorlib/shared/System/Reflection/TargetInvocationException.cs +++ b/src/mscorlib/shared/System/Reflection/TargetInvocationException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Reflection { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class TargetInvocationException : ApplicationException { public TargetInvocationException(Exception inner) @@ -19,5 +21,10 @@ namespace System.Reflection { HResult = HResults.COR_E_TARGETINVOCATION; } + + internal TargetInvocationException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs b/src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs index f31758b..c68c467 100644 --- a/src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs +++ b/src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Reflection { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class TargetParameterCountException : ApplicationException { public TargetParameterCountException() @@ -25,5 +27,10 @@ namespace System.Reflection { HResult = HResults.COR_E_TARGETPARAMCOUNT; } + + internal TargetParameterCountException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs b/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs index e11d15d..20914ac 100644 --- a/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs +++ b/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.Resources { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MissingManifestResourceException : SystemException { public MissingManifestResourceException() @@ -30,7 +32,6 @@ namespace System.Resources protected MissingManifestResourceException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs b/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs index 615aed6..af547b2 100644 --- a/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs +++ b/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs @@ -20,6 +20,8 @@ using System.Runtime.Serialization; namespace System.Resources { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MissingSatelliteAssemblyException : SystemException { private String _cultureName; @@ -52,7 +54,6 @@ namespace System.Resources protected MissingSatelliteAssemblyException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } public String CultureName diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs index e4af9be..c86a232 100644 --- a/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs +++ b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Diagnostics.Contracts; using System.Runtime.Serialization; namespace System.Runtime.CompilerServices @@ -10,6 +11,8 @@ namespace System.Runtime.CompilerServices /// /// Exception used to wrap all non-CLS compliant exceptions. /// + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class RuntimeWrappedException : Exception { private Object _wrappedException; // EE expects this name @@ -25,7 +28,19 @@ namespace System.Runtime.CompilerServices public override void GetObjectData(SerializationInfo info, StreamingContext context) { + if (info == null) + { + throw new ArgumentNullException(nameof(info)); + } + Contract.EndContractBlock(); base.GetObjectData(info, context); + info.AddValue("WrappedException", _wrappedException, typeof(object)); + } + + internal RuntimeWrappedException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + _wrappedException = info.GetValue("WrappedException", typeof(object)); } public Object WrappedException => _wrappedException; diff --git a/src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs b/src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs index 0861d19..160fe30 100644 --- a/src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs +++ b/src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs @@ -20,7 +20,8 @@ namespace System.Runtime.InteropServices { // Base exception for COM Interop errors &; Structured Exception Handler // exceptions. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ExternalException : SystemException { public ExternalException() @@ -50,7 +51,6 @@ namespace System.Runtime.InteropServices protected ExternalException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } public virtual int ErrorCode diff --git a/src/mscorlib/shared/System/Runtime/Serialization/SerializationException.cs b/src/mscorlib/shared/System/Runtime/Serialization/SerializationException.cs index 3e0af09..1c9c21e 100644 --- a/src/mscorlib/shared/System/Runtime/Serialization/SerializationException.cs +++ b/src/mscorlib/shared/System/Runtime/Serialization/SerializationException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Runtime.Serialization { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SerializationException : SystemException { private static String s_nullMessage = SR.SerializationException; @@ -33,7 +35,6 @@ namespace System.Runtime.Serialization protected SerializationException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Security/CryptographicException.cs b/src/mscorlib/shared/System/Security/CryptographicException.cs index 7c4fa17..78ee290 100644 --- a/src/mscorlib/shared/System/Security/CryptographicException.cs +++ b/src/mscorlib/shared/System/Security/CryptographicException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.Security.Cryptography { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class CryptographicException : SystemException { public CryptographicException() @@ -38,7 +40,6 @@ namespace System.Security.Cryptography protected CryptographicException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Security/SecurityException.cs b/src/mscorlib/shared/System/Security/SecurityException.cs index 2866a47..51a23b1 100644 --- a/src/mscorlib/shared/System/Security/SecurityException.cs +++ b/src/mscorlib/shared/System/Security/SecurityException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.Security { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SecurityException : SystemException { public SecurityException() @@ -45,7 +47,6 @@ namespace System.Security protected SecurityException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } public override string ToString() => base.ToString(); diff --git a/src/mscorlib/shared/System/Security/VerificationException.cs b/src/mscorlib/shared/System/Security/VerificationException.cs index bd095f3..e2afd4c 100644 --- a/src/mscorlib/shared/System/Security/VerificationException.cs +++ b/src/mscorlib/shared/System/Security/VerificationException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Security { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class VerificationException : SystemException { public VerificationException() @@ -29,7 +31,6 @@ namespace System.Security protected VerificationException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/StackOverflowException.cs b/src/mscorlib/shared/System/StackOverflowException.cs index 8b21eb7..6f954cc7 100644 --- a/src/mscorlib/shared/System/StackOverflowException.cs +++ b/src/mscorlib/shared/System/StackOverflowException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class StackOverflowException : SystemException { public StackOverflowException() @@ -34,5 +36,9 @@ namespace System { HResult = HResults.COR_E_STACKOVERFLOW; } + + internal StackOverflowException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/SystemException.cs b/src/mscorlib/shared/System/SystemException.cs index 64a4b9c..b7e8e42 100644 --- a/src/mscorlib/shared/System/SystemException.cs +++ b/src/mscorlib/shared/System/SystemException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SystemException : Exception { public SystemException() @@ -28,7 +30,6 @@ namespace System protected SystemException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Threading/AbandonedMutexException.cs b/src/mscorlib/shared/System/Threading/AbandonedMutexException.cs index c43148d..c7e604f 100644 --- a/src/mscorlib/shared/System/Threading/AbandonedMutexException.cs +++ b/src/mscorlib/shared/System/Threading/AbandonedMutexException.cs @@ -14,6 +14,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class AbandonedMutexException : SystemException { private int _mutexIndex = -1; @@ -61,7 +63,6 @@ namespace System.Threading protected AbandonedMutexException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } private void SetupException(int location, WaitHandle handle) diff --git a/src/mscorlib/shared/System/Threading/LockRecursionException.cs b/src/mscorlib/shared/System/Threading/LockRecursionException.cs index 86e1903..ac7c1b6 100644 --- a/src/mscorlib/shared/System/Threading/LockRecursionException.cs +++ b/src/mscorlib/shared/System/Threading/LockRecursionException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class LockRecursionException : System.Exception { public LockRecursionException() @@ -25,7 +27,6 @@ namespace System.Threading protected LockRecursionException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Threading/SemaphoreFullException.cs b/src/mscorlib/shared/System/Threading/SemaphoreFullException.cs index 777463b..883e167 100644 --- a/src/mscorlib/shared/System/Threading/SemaphoreFullException.cs +++ b/src/mscorlib/shared/System/Threading/SemaphoreFullException.cs @@ -7,6 +7,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SemaphoreFullException : SystemException { public SemaphoreFullException() : base(SR.Threading_SemaphoreFullException) @@ -23,7 +25,6 @@ namespace System.Threading protected SemaphoreFullException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Threading/SynchronizationLockException.cs b/src/mscorlib/shared/System/Threading/SynchronizationLockException.cs index 5ab186e..e050e15 100644 --- a/src/mscorlib/shared/System/Threading/SynchronizationLockException.cs +++ b/src/mscorlib/shared/System/Threading/SynchronizationLockException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SynchronizationLockException : SystemException { public SynchronizationLockException() @@ -38,7 +40,6 @@ namespace System.Threading protected SynchronizationLockException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs b/src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs index 6657bcd..6f7fc68 100644 --- a/src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs +++ b/src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs @@ -19,6 +19,8 @@ namespace System.Threading.Tasks /// /// Represents an exception used to communicate task cancellation. /// + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TaskCanceledException : OperationCanceledException { [NonSerialized] @@ -70,7 +72,6 @@ namespace System.Threading.Tasks /// The that contains contextual information about the source or destination. protected TaskCanceledException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } /// diff --git a/src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs b/src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs index 2888415..85ec497 100644 --- a/src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs +++ b/src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs @@ -20,6 +20,8 @@ namespace System.Threading.Tasks /// Represents an exception used to communicate an invalid operation by a /// . /// + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TaskSchedulerException : Exception { /// @@ -71,7 +73,6 @@ namespace System.Threading.Tasks protected TaskSchedulerException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Threading/ThreadAbortException.cs b/src/mscorlib/shared/System/Threading/ThreadAbortException.cs index 01fdf13..360e84d 100644 --- a/src/mscorlib/shared/System/Threading/ThreadAbortException.cs +++ b/src/mscorlib/shared/System/Threading/ThreadAbortException.cs @@ -18,6 +18,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class ThreadAbortException : SystemException { internal ThreadAbortException() @@ -26,5 +28,10 @@ namespace System.Threading } public object ExceptionState => null; + + internal ThreadAbortException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/Threading/ThreadStartException.cs b/src/mscorlib/shared/System/Threading/ThreadStartException.cs index 35930d1..c6b180a 100644 --- a/src/mscorlib/shared/System/Threading/ThreadStartException.cs +++ b/src/mscorlib/shared/System/Threading/ThreadStartException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class ThreadStartException : SystemException { internal ThreadStartException() @@ -19,5 +21,10 @@ namespace System.Threading { HResult = HResults.COR_E_THREADSTART; } + + internal ThreadStartException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } } diff --git a/src/mscorlib/shared/System/Threading/ThreadStateException.cs b/src/mscorlib/shared/System/Threading/ThreadStateException.cs index d8f97a4..6fc06a8 100644 --- a/src/mscorlib/shared/System/Threading/ThreadStateException.cs +++ b/src/mscorlib/shared/System/Threading/ThreadStateException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ThreadStateException : SystemException { public ThreadStateException() @@ -39,7 +41,6 @@ namespace System.Threading protected ThreadStateException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/Threading/WaitHandleCannotBeOpenedException.cs b/src/mscorlib/shared/System/Threading/WaitHandleCannotBeOpenedException.cs index 47e1271..e60e46d 100644 --- a/src/mscorlib/shared/System/Threading/WaitHandleCannotBeOpenedException.cs +++ b/src/mscorlib/shared/System/Threading/WaitHandleCannotBeOpenedException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class WaitHandleCannotBeOpenedException : ApplicationException { public WaitHandleCannotBeOpenedException() : base(SR.Threading_WaitHandleCannotBeOpenedException) @@ -25,7 +27,6 @@ namespace System.Threading protected WaitHandleCannotBeOpenedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/TimeZoneNotFoundException.cs b/src/mscorlib/shared/System/TimeZoneNotFoundException.cs index 5b7ce10..5eccfd5 100644 --- a/src/mscorlib/shared/System/TimeZoneNotFoundException.cs +++ b/src/mscorlib/shared/System/TimeZoneNotFoundException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TimeZoneNotFoundException : Exception { public TimeZoneNotFoundException() @@ -24,7 +26,6 @@ namespace System protected TimeZoneNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/TimeoutException.cs b/src/mscorlib/shared/System/TimeoutException.cs index b50ae2f..ddaa477 100644 --- a/src/mscorlib/shared/System/TimeoutException.cs +++ b/src/mscorlib/shared/System/TimeoutException.cs @@ -15,6 +15,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TimeoutException : SystemException { public TimeoutException() @@ -37,7 +39,6 @@ namespace System protected TimeoutException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/TypeAccessException.cs b/src/mscorlib/shared/System/TypeAccessException.cs index ff08158..e12a8b0 100644 --- a/src/mscorlib/shared/System/TypeAccessException.cs +++ b/src/mscorlib/shared/System/TypeAccessException.cs @@ -8,6 +8,8 @@ namespace System { // TypeAccessException derives from TypeLoadException rather than MemberAccessException because in // pre-v4 releases of the runtime TypeLoadException was used in lieu of a TypeAccessException. + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TypeAccessException : TypeLoadException { public TypeAccessException() @@ -30,7 +32,6 @@ namespace System protected TypeAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/TypeInitializationException.cs b/src/mscorlib/shared/System/TypeInitializationException.cs index 03a1bad..4bf2906 100644 --- a/src/mscorlib/shared/System/TypeInitializationException.cs +++ b/src/mscorlib/shared/System/TypeInitializationException.cs @@ -19,6 +19,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class TypeInitializationException : SystemException { private String _typeName; @@ -51,9 +53,16 @@ namespace System HResult = HResults.COR_E_TYPEINITIALIZATION; } + internal TypeInitializationException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + _typeName = info.GetString("TypeName"); + } + public override void GetObjectData(SerializationInfo info, StreamingContext context) { base.GetObjectData(info, context); + info.AddValue("TypeName", TypeName, typeof(string)); } public String TypeName diff --git a/src/mscorlib/shared/System/TypeUnloadedException.cs b/src/mscorlib/shared/System/TypeUnloadedException.cs index 97039bb..a01ef37 100644 --- a/src/mscorlib/shared/System/TypeUnloadedException.cs +++ b/src/mscorlib/shared/System/TypeUnloadedException.cs @@ -6,6 +6,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TypeUnloadedException : SystemException { public TypeUnloadedException() @@ -29,7 +31,6 @@ namespace System protected TypeUnloadedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/shared/System/UnauthorizedAccessException.cs b/src/mscorlib/shared/System/UnauthorizedAccessException.cs index 679a1a7..a28f6dd 100644 --- a/src/mscorlib/shared/System/UnauthorizedAccessException.cs +++ b/src/mscorlib/shared/System/UnauthorizedAccessException.cs @@ -18,7 +18,9 @@ using System.Runtime.Serialization; namespace System { // The UnauthorizedAccessException is thrown when access errors - // occur from IO or other OS methods. + // occur from IO or other OS methods. + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class UnauthorizedAccessException : SystemException { public UnauthorizedAccessException() @@ -41,7 +43,6 @@ namespace System protected UnauthorizedAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/AppDomainUnloadedException.cs b/src/mscorlib/src/System/AppDomainUnloadedException.cs index b673d8c..597a39c 100644 --- a/src/mscorlib/src/System/AppDomainUnloadedException.cs +++ b/src/mscorlib/src/System/AppDomainUnloadedException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] internal class AppDomainUnloadedException : SystemException { public AppDomainUnloadedException() @@ -24,12 +26,8 @@ namespace System HResult = HResults.COR_E_APPDOMAINUNLOADED; } - // - //This constructor is required for serialization. - // protected AppDomainUnloadedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/InsufficientMemoryException.cs b/src/mscorlib/src/System/InsufficientMemoryException.cs index b4bc588..b5f369e 100644 --- a/src/mscorlib/src/System/InsufficientMemoryException.cs +++ b/src/mscorlib/src/System/InsufficientMemoryException.cs @@ -22,6 +22,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class InsufficientMemoryException : OutOfMemoryException { public InsufficientMemoryException() @@ -41,5 +43,9 @@ namespace System { HResult = HResults.COR_E_INSUFFICIENTMEMORY; } + + private InsufficientMemoryException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } } } diff --git a/src/mscorlib/src/System/MissingFieldException.cs b/src/mscorlib/src/System/MissingFieldException.cs index 31931bf..0225414 100644 --- a/src/mscorlib/src/System/MissingFieldException.cs +++ b/src/mscorlib/src/System/MissingFieldException.cs @@ -17,6 +17,8 @@ using System.Globalization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MissingFieldException : MissingMemberException, ISerializable { public MissingFieldException() @@ -39,7 +41,6 @@ namespace System protected MissingFieldException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } public override String Message diff --git a/src/mscorlib/src/System/MissingMemberException.cs b/src/mscorlib/src/System/MissingMemberException.cs index 44ceaaf..c818169 100644 --- a/src/mscorlib/src/System/MissingMemberException.cs +++ b/src/mscorlib/src/System/MissingMemberException.cs @@ -17,9 +17,12 @@ using System.Runtime.Serialization; using System.Runtime.CompilerServices; using System.Globalization; using System.Runtime.Versioning; +using System.Diagnostics.Contracts; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MissingMemberException : MemberAccessException, ISerializable { public MissingMemberException() @@ -42,7 +45,9 @@ namespace System protected MissingMemberException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + ClassName = (string)info.GetString("MMClassName"); + MemberName = (string)info.GetString("MMMemberName"); + Signature = (byte[])info.GetValue("MMSignature", typeof(byte[])); } public override String Message @@ -73,7 +78,14 @@ namespace System public override void GetObjectData(SerializationInfo info, StreamingContext context) { + if (info == null) + { + throw new ArgumentNullException(nameof(info)); + } + Contract.EndContractBlock(); base.GetObjectData(info, context); + info.AddValue("MMClassName", ClassName, typeof(string)); + info.AddValue("MMSignature", Signature, typeof(byte[])); } diff --git a/src/mscorlib/src/System/OutOfMemoryException.cs b/src/mscorlib/src/System/OutOfMemoryException.cs index 8ef2d7b..33cf639 100644 --- a/src/mscorlib/src/System/OutOfMemoryException.cs +++ b/src/mscorlib/src/System/OutOfMemoryException.cs @@ -17,6 +17,8 @@ using System.Runtime.Serialization; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class OutOfMemoryException : SystemException { public OutOfMemoryException() @@ -39,7 +41,6 @@ namespace System protected OutOfMemoryException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs b/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs index 6d9927f..c31a157 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs @@ -21,7 +21,8 @@ using Microsoft.Win32; namespace System.Runtime.InteropServices { // Exception for COM Interop errors where we don't recognize the HResult. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class COMException : ExternalException { public COMException() @@ -50,7 +51,6 @@ namespace System.Runtime.InteropServices protected COMException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } public override String ToString() diff --git a/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs b/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs index c3ce68d..d1ae2e2 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs @@ -17,6 +17,8 @@ using System.Runtime.Serialization; namespace System.Runtime.InteropServices { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class InvalidComObjectException : SystemException { public InvalidComObjectException() @@ -39,7 +41,6 @@ namespace System.Runtime.InteropServices protected InvalidComObjectException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs b/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs index f61010c..7402908 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System.Runtime.InteropServices { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class InvalidOleVariantTypeException : SystemException { public InvalidOleVariantTypeException() @@ -38,7 +40,6 @@ namespace System.Runtime.InteropServices protected InvalidOleVariantTypeException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs b/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs index 48e2dcf..1d0d59f 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs @@ -17,6 +17,8 @@ using System.Runtime.Serialization; namespace System.Runtime.InteropServices { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class MarshalDirectiveException : SystemException { public MarshalDirectiveException() @@ -39,7 +41,6 @@ namespace System.Runtime.InteropServices protected MarshalDirectiveException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/SEHException.cs b/src/mscorlib/src/System/Runtime/InteropServices/SEHException.cs index 832c4d2..039059e 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/SEHException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/SEHException.cs @@ -18,7 +18,8 @@ using System.Runtime.Serialization; namespace System.Runtime.InteropServices { // Exception for Structured Exception Handler exceptions. - // + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SEHException : ExternalException { public SEHException() @@ -41,7 +42,6 @@ namespace System.Runtime.InteropServices protected SEHException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } // Exceptions can be resumable, meaning a filtered exception diff --git a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs index 7109b4f..7f6a24f 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs @@ -16,6 +16,8 @@ using System.Runtime.Serialization; namespace System.Runtime.InteropServices { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SafeArrayRankMismatchException : SystemException { public SafeArrayRankMismatchException() @@ -38,7 +40,6 @@ namespace System.Runtime.InteropServices protected SafeArrayRankMismatchException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs index 13a6cf6..e155dcf 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs @@ -17,6 +17,8 @@ using System.Runtime.Serialization; namespace System.Runtime.InteropServices { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class SafeArrayTypeMismatchException : SystemException { public SafeArrayTypeMismatchException() @@ -39,7 +41,6 @@ namespace System.Runtime.InteropServices protected SafeArrayTypeMismatchException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/Threading/ThreadInterruptedException.cs b/src/mscorlib/src/System/Threading/ThreadInterruptedException.cs index db42b77..80e25e6 100644 --- a/src/mscorlib/src/System/Threading/ThreadInterruptedException.cs +++ b/src/mscorlib/src/System/Threading/ThreadInterruptedException.cs @@ -19,6 +19,8 @@ using System.Runtime.Serialization; namespace System.Threading { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ThreadInterruptedException : SystemException { public ThreadInterruptedException() @@ -41,7 +43,6 @@ namespace System.Threading protected ThreadInterruptedException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); } } } diff --git a/src/mscorlib/src/System/TypeLoadException.cs b/src/mscorlib/src/System/TypeLoadException.cs index 90541da..13f8651 100644 --- a/src/mscorlib/src/System/TypeLoadException.cs +++ b/src/mscorlib/src/System/TypeLoadException.cs @@ -18,9 +18,12 @@ using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; +using System.Diagnostics.Contracts; namespace System { + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class TypeLoadException : SystemException, ISerializable { public TypeLoadException() @@ -103,7 +106,13 @@ namespace System protected TypeLoadException(SerializationInfo info, StreamingContext context) : base(info, context) { - throw new PlatformNotSupportedException(); + if (info == null) + throw new ArgumentNullException(nameof(info)); + Contract.EndContractBlock(); + ClassName = info.GetString("TypeLoadClassName"); + AssemblyName = info.GetString("TypeLoadAssemblyName"); + MessageArg = info.GetString("TypeLoadMessageArg"); + ResourceId = info.GetInt32("TypeLoadResourceID"); } [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)] @@ -112,7 +121,15 @@ namespace System public override void GetObjectData(SerializationInfo info, StreamingContext context) { + if (info == null) + throw new ArgumentNullException(nameof(info)); + Contract.EndContractBlock(); + base.GetObjectData(info, context); + info.AddValue("TypeLoadClassName", ClassName, typeof(string)); + info.AddValue("TypeLoadAssemblyName", AssemblyName, typeof(string)); + info.AddValue("TypeLoadMessageArg", MessageArg, typeof(string)); + info.AddValue("TypeLoadResourceID", ResourceId); } // If ClassName != null, GetMessage will construct on the fly using it -- 2.7.4