Make coreclr exceptions serializable and add typeforwards
authorViktor Hofer <viktor.hofer@outlook.com>
Tue, 3 Oct 2017 20:11:09 +0000 (22:11 +0200)
committerViktor Hofer <viktor.hofer@outlook.com>
Tue, 3 Oct 2017 20:11:09 +0000 (22:11 +0200)
90 files changed:
src/mscorlib/shared/System/AccessViolationException.cs
src/mscorlib/shared/System/ApplicationException.cs
src/mscorlib/shared/System/ArgumentException.cs
src/mscorlib/shared/System/ArgumentNullException.cs
src/mscorlib/shared/System/ArgumentOutOfRangeException.cs
src/mscorlib/shared/System/ArithmeticException.cs
src/mscorlib/shared/System/ArrayTypeMismatchException.cs
src/mscorlib/shared/System/BadImageFormatException.cs
src/mscorlib/shared/System/Collections/Generic/KeyNotFoundException.cs
src/mscorlib/shared/System/DataMisalignedException.cs
src/mscorlib/shared/System/DivideByZeroException.cs
src/mscorlib/shared/System/DllNotFoundException.cs
src/mscorlib/shared/System/DuplicateWaitObjectException.cs
src/mscorlib/shared/System/EntryPointNotFoundException.cs
src/mscorlib/shared/System/ExecutionEngineException.cs
src/mscorlib/shared/System/FieldAccessException.cs
src/mscorlib/shared/System/FormatException.cs
src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs
src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs
src/mscorlib/shared/System/IO/DriveNotFoundException.cs
src/mscorlib/shared/System/IO/EndOfStreamException.cs
src/mscorlib/shared/System/IO/FileLoadException.cs
src/mscorlib/shared/System/IO/FileNotFoundException.cs
src/mscorlib/shared/System/IO/IOException.cs
src/mscorlib/shared/System/IO/PathTooLongException.cs
src/mscorlib/shared/System/IndexOutOfRangeException.cs
src/mscorlib/shared/System/InsufficientExecutionStackException.cs
src/mscorlib/shared/System/InvalidCastException.cs
src/mscorlib/shared/System/InvalidOperationException.cs
src/mscorlib/shared/System/InvalidProgramException.cs
src/mscorlib/shared/System/InvalidTimeZoneException.cs
src/mscorlib/shared/System/MemberAccessException.cs
src/mscorlib/shared/System/MethodAccessException.cs
src/mscorlib/shared/System/MissingMethodException.cs
src/mscorlib/shared/System/MulticastNotSupportedException.cs
src/mscorlib/shared/System/NotFiniteNumberException.cs
src/mscorlib/shared/System/NotImplementedException.cs
src/mscorlib/shared/System/NotSupportedException.cs
src/mscorlib/shared/System/NullReferenceException.cs
src/mscorlib/shared/System/ObjectDisposedException.cs
src/mscorlib/shared/System/OperationCanceledException.cs
src/mscorlib/shared/System/OverflowException.cs
src/mscorlib/shared/System/PlatformNotSupportedException.cs
src/mscorlib/shared/System/RankException.cs
src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs
src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs
src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs
src/mscorlib/shared/System/Reflection/TargetException.cs
src/mscorlib/shared/System/Reflection/TargetInvocationException.cs
src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs
src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs
src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs
src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeWrappedException.cs
src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs
src/mscorlib/shared/System/Runtime/Serialization/SerializationException.cs
src/mscorlib/shared/System/Security/CryptographicException.cs
src/mscorlib/shared/System/Security/SecurityException.cs
src/mscorlib/shared/System/Security/VerificationException.cs
src/mscorlib/shared/System/StackOverflowException.cs
src/mscorlib/shared/System/SystemException.cs
src/mscorlib/shared/System/Threading/AbandonedMutexException.cs
src/mscorlib/shared/System/Threading/LockRecursionException.cs
src/mscorlib/shared/System/Threading/SemaphoreFullException.cs
src/mscorlib/shared/System/Threading/SynchronizationLockException.cs
src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs
src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs
src/mscorlib/shared/System/Threading/ThreadAbortException.cs
src/mscorlib/shared/System/Threading/ThreadStartException.cs
src/mscorlib/shared/System/Threading/ThreadStateException.cs
src/mscorlib/shared/System/Threading/WaitHandleCannotBeOpenedException.cs
src/mscorlib/shared/System/TimeZoneNotFoundException.cs
src/mscorlib/shared/System/TimeoutException.cs
src/mscorlib/shared/System/TypeAccessException.cs
src/mscorlib/shared/System/TypeInitializationException.cs
src/mscorlib/shared/System/TypeUnloadedException.cs
src/mscorlib/shared/System/UnauthorizedAccessException.cs
src/mscorlib/src/System/AppDomainUnloadedException.cs
src/mscorlib/src/System/InsufficientMemoryException.cs
src/mscorlib/src/System/MissingFieldException.cs
src/mscorlib/src/System/MissingMemberException.cs
src/mscorlib/src/System/OutOfMemoryException.cs
src/mscorlib/src/System/Runtime/InteropServices/COMException.cs
src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs
src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs
src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs
src/mscorlib/src/System/Runtime/InteropServices/SEHException.cs
src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs
src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs
src/mscorlib/src/System/Threading/ThreadInterruptedException.cs
src/mscorlib/src/System/TypeLoadException.cs

index 103a4c0..280d9b8 100644 (file)
@@ -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.
index 83ced79..f36e2c1 100644 (file)
@@ -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();
         }
     }
 }
index fe65d64..8a8fe3e 100644 (file)
@@ -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
index 9b0732b..80e43cc 100644 (file)
@@ -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();
         }
     }
 }
index a25cd57..604caa8 100644 (file)
@@ -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
index 6285c81..606f1de 100644 (file)
@@ -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();
         }
     }
 }
index 6964b1f..49820f5 100644 (file)
@@ -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();
         }
     }
 }
index a4661fc..1743075 100644 (file)
@@ -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
index c32bc62..48eddb8 100644 (file)
@@ -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();
         }
     }
 }
index d8d36b5..2a245b6 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index ad74bde..b309695 100644 (file)
@@ -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();
         }
     }
 }
index 82d5bdd..14fb50d 100644 (file)
@@ -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();
         }
     }
 }
index 95bdedd..7730384 100644 (file)
@@ -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();
         }
     }
 }
index e62ca0e..dac1cdb 100644 (file)
@@ -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();
         }
     }
 }
index c334358..5edd5cf 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index 883bbd8..cb28264 100644 (file)
@@ -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();
         }
     }
 }
index 4af45cd..b0e2733 100644 (file)
@@ -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();
         }
     }
 }
index dde1a8b..10e8b1f 100644 (file)
@@ -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<int> InvalidCultureId
index 87e610b..d7c6eac 100644 (file)
@@ -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();
         }
     }
 }
index c0f8c55..3f2c88c 100644 (file)
@@ -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();
         }
     }
 }
index ee37818..606073a 100644 (file)
@@ -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();
         }
     }
 }
index b126424..8c31244 100644 (file)
@@ -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));
         }
     }
 }
index dc1ccf5..72cff4c 100644 (file)
@@ -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));
         }
     }
 }
index 1fbd352..89b25d5 100644 (file)
@@ -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();
         }
     }
 }
index 15f282e..7af2452 100644 (file)
@@ -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();
         }
     }
 }
index bec63d7..b6d93ef 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index a14cb67..4822028 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index 00b393c..0556432 100644 (file)
@@ -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();
         }
     }
 }
index 74a4ffd..62c222a 100644 (file)
@@ -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();
         }
     }
 }
index e352157..c8047c5 100644 (file)
@@ -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) { }
     }
 }
index 8b300f4..07450b0 100644 (file)
@@ -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();
         }
     }
 }
index bb26d9e..dfea52d 100644 (file)
@@ -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();
         }
     }
 }
index 1269138..1ca0297 100644 (file)
@@ -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();
         }
     }
 }
index 4f5e8b6..abb6c0e 100644 (file)
@@ -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
index 56a3ec9..cc6c770 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index ca47a21..259248f 100644 (file)
@@ -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
index 98976c1..1a3b6af 100644 (file)
@@ -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();
         }
     }
 }
index dc43261..3180bc2 100644 (file)
@@ -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();
         }
     }
 }
index eb6d709..c2e7224 100644 (file)
@@ -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();
         }
     }
 }
index 3d7ba5d..be80c6d 100644 (file)
@@ -11,6 +11,8 @@ namespace System
     ///    <para> The exception that is thrown when accessing an object that was
     ///       disposed.</para>
     /// </devdoc>
+    [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));
         }
 
         /// <devdoc>
index 44a0427..8a472c9 100644 (file)
@@ -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();
         }
     }
 }
index bf6676c..963825b 100644 (file)
@@ -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();
         }
     }
 }
index 4403c1d..5039f3f 100644 (file)
@@ -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();
         }
     }
 }
index f2c5d06..bdd2cd5 100644 (file)
@@ -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();
         }
     }
 }
index c4aeca7..643a127 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index ae67158..1d7d4a7 100644 (file)
@@ -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();
         }
     }
 }
index 85a4477..dedcc54 100644 (file)
@@ -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();
         }
     }
 }
index 2309daa..c200000 100644 (file)
@@ -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();
         }
     }
 }
index 7c4f60a..822ddfd 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index f31758b..c68c467 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index e11d15d..20914ac 100644 (file)
@@ -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();
         }
     }
 }
index 615aed6..af547b2 100644 (file)
@@ -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
index e4af9be..c86a232 100644 (file)
@@ -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
     /// <summary>
     /// Exception used to wrap all non-CLS compliant exceptions.
     /// </summary>
+    [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;
index 0861d19..160fe30 100644 (file)
@@ -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
index 3e0af09..1c9c21e 100644 (file)
@@ -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();
         }
     }
 }
index 7c4fa17..78ee290 100644 (file)
@@ -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();
         }
     }
 }
index 2866a47..51a23b1 100644 (file)
@@ -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();
index bd095f3..e2afd4c 100644 (file)
@@ -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();
         }
     }
 }
index 8b21eb7..6f954cc 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index 64a4b9c..b7e8e42 100644 (file)
@@ -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();
         }
     }
 }
index c43148d..c7e604f 100644 (file)
@@ -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)
index 86e1903..ac7c1b6 100644 (file)
@@ -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();
         }
     }
 }
index 777463b..883e167 100644 (file)
@@ -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();
         }
     }
 }
index 5ab186e..e050e15 100644 (file)
@@ -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();
         }
     }
 }
index 6657bcd..6f7fc68 100644 (file)
@@ -19,6 +19,8 @@ namespace System.Threading.Tasks
     /// <summary>
     /// Represents an exception used to communicate task cancellation.
     /// </summary>
+    [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
         /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination. </param>
         protected TaskCanceledException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
-            throw new PlatformNotSupportedException();
         }
 
         /// <summary>
index 2888415..85ec497 100644 (file)
@@ -20,6 +20,8 @@ namespace System.Threading.Tasks
     /// Represents an exception used to communicate an invalid operation by a
     /// <see cref="T:System.Threading.Tasks.TaskScheduler"/>.
     /// </summary>
+    [Serializable]
+    [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
     public class TaskSchedulerException : Exception
     {
         /// <summary>
@@ -71,7 +73,6 @@ namespace System.Threading.Tasks
         protected TaskSchedulerException(SerializationInfo info, StreamingContext context)
             : base(info, context)
         {
-            throw new PlatformNotSupportedException();
         }
     }
 }
index 01fdf13..360e84d 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index 35930d1..c6b180a 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index d8f97a4..6fc06a8 100644 (file)
@@ -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();
         }
     }
 }
index 47e1271..e60e46d 100644 (file)
@@ -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();
         }
     }
 }
index 5b7ce10..5eccfd5 100644 (file)
@@ -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();
         }
     }
 }
index b50ae2f..ddaa477 100644 (file)
@@ -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();
         }
     }
 }
index ff08158..e12a8b0 100644 (file)
@@ -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();
         }
     }
 }
index 03a1bad..4bf2906 100644 (file)
@@ -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
index 97039bb..a01ef37 100644 (file)
@@ -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();
         }
     }
 }
index 679a1a7..a28f6dd 100644 (file)
@@ -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();
         }
     }
 }
index b673d8c..597a39c 100644 (file)
@@ -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();
         }
     }
 }
index b4bc588..b5f369e 100644 (file)
@@ -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)
+        {
+        }
     }
 }
index 31931bf..0225414 100644 (file)
@@ -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
index 44ceaaf..c818169 100644 (file)
@@ -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[]));
         }
 
 
index 8ef2d7b..33cf639 100644 (file)
@@ -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();
         }
     }
 }
index 6d9927f..c31a157 100644 (file)
@@ -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()
index c3ce68d..d1ae2e2 100644 (file)
@@ -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();
         }
     }
 }
index f61010c..7402908 100644 (file)
@@ -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();
         }
     }
 }
index 48e2dcf..1d0d59f 100644 (file)
@@ -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();
         }
     }
 }
index 832c4d2..039059e 100644 (file)
@@ -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 
index 7109b4f..7f6a24f 100644 (file)
@@ -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();
         }
     }
 }
index 13a6cf6..e155dcf 100644 (file)
@@ -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();
         }
     }
 }
index db42b77..80e25e6 100644 (file)
@@ -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();
         }
     }
 }
index 90541da..13f8651 100644 (file)
@@ -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