Fix FxCop warning CA2229 (private deserialization ctor)
authorStephen Toub <stoub@microsoft.com>
Thu, 8 Aug 2019 19:12:50 +0000 (15:12 -0400)
committerStephen Toub <stoub@microsoft.com>
Fri, 9 Aug 2019 11:54:53 +0000 (07:54 -0400)
Commit migrated from https://github.com/dotnet/coreclr/commit/17655f12b5ba2230a544dbe10eaceaf444a77965

14 files changed:
src/libraries/System.Private.CoreLib/src/System/DataMisalignedException.cs
src/libraries/System.Private.CoreLib/src/System/ExecutionEngineException.cs
src/libraries/System.Private.CoreLib/src/System/IndexOutOfRangeException.cs
src/libraries/System.Private.CoreLib/src/System/InsufficientExecutionStackException.cs
src/libraries/System.Private.CoreLib/src/System/InvalidProgramException.cs
src/libraries/System.Private.CoreLib/src/System/MulticastNotSupportedException.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/AmbiguousMatchException.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/TargetInvocationException.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/TargetParameterCountException.cs
src/libraries/System.Private.CoreLib/src/System/StackOverflowException.cs
src/libraries/System.Private.CoreLib/src/System/Threading/ThreadAbortException.cs
src/libraries/System.Private.CoreLib/src/System/TypeInitializationException.cs
src/libraries/System.Private.CoreLib/src/System/UnitySerializationHolder.cs
src/libraries/System.Private.CoreLib/src/System/WeakReference.T.cs

index 2b49e5a..927abe0 100644 (file)
@@ -35,7 +35,7 @@ namespace System
             HResult = HResults.COR_E_DATAMISALIGNED;
         }
 
-        internal DataMisalignedException(SerializationInfo info, StreamingContext context) : base(info, context)
+        private DataMisalignedException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
         }
     }
index 2d6da9c..b804599 100644 (file)
@@ -43,7 +43,7 @@ namespace System
             HResult = HResults.COR_E_EXECUTIONENGINE;
         }
 
-        internal ExecutionEngineException(SerializationInfo info, StreamingContext context) : base(info, context)
+        private ExecutionEngineException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
         }
     }
index ec4195c..b2ef538 100644 (file)
@@ -37,7 +37,7 @@ namespace System
             HResult = HResults.COR_E_INDEXOUTOFRANGE;
         }
 
-        internal IndexOutOfRangeException(SerializationInfo info, StreamingContext context) : base(info, context)
+        private IndexOutOfRangeException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
         }
     }
index bb60d53..998a824 100644 (file)
@@ -28,7 +28,7 @@ namespace System
             HResult = HResults.COR_E_INSUFFICIENTEXECUTIONSTACK;
         }
 
-        internal InsufficientExecutionStackException(SerializationInfo info, StreamingContext context) : base(info, context)
+        private InsufficientExecutionStackException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
         }
     }
index 236768e..d20391b 100644 (file)
@@ -37,6 +37,6 @@ namespace System
             HResult = HResults.COR_E_INVALIDPROGRAM;
         }
 
-        internal InvalidProgramException(SerializationInfo info, StreamingContext context) : base(info, context) { }
+        private InvalidProgramException(SerializationInfo info, StreamingContext context) : base(info, context) { }
     }
 }
index 898b2eb..34c7ed5 100644 (file)
@@ -33,7 +33,7 @@ namespace System
             HResult = HResults.COR_E_MULTICASTNOTSUPPORTED;
         }
 
-        internal MulticastNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context)
+        private MulticastNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
         }
     }
index 7db74c6..f6472c9 100644 (file)
@@ -28,7 +28,7 @@ namespace System.Reflection
             HResult = HResults.COR_E_AMBIGUOUSMATCH;
         }
 
-        internal AmbiguousMatchException(SerializationInfo info, StreamingContext context) : base(info, context)
+        private AmbiguousMatchException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
         }
     }
index 9d92532..d529e64 100644 (file)
@@ -22,7 +22,7 @@ namespace System.Reflection
             HResult = HResults.COR_E_TARGETINVOCATION;
         }
 
-        internal TargetInvocationException(SerializationInfo info, StreamingContext context)
+        private TargetInvocationException(SerializationInfo info, StreamingContext context)
             : base(info, context)
         {
         }
index aaf1c33..888068d 100644 (file)
@@ -28,7 +28,7 @@ namespace System.Reflection
             HResult = HResults.COR_E_TARGETPARAMCOUNT;
         }
 
-        internal TargetParameterCountException(SerializationInfo info, StreamingContext context)
+        private TargetParameterCountException(SerializationInfo info, StreamingContext context)
             : base(info, context)
         {
         }
index 0177b58..a1dd460 100644 (file)
@@ -37,7 +37,7 @@ namespace System
             HResult = HResults.COR_E_STACKOVERFLOW;
         }
 
-        internal StackOverflowException(SerializationInfo info, StreamingContext context) : base(info, context)
+        private StackOverflowException(SerializationInfo info, StreamingContext context) : base(info, context)
         {
         }
     }
index 9391bb4..574e27f 100644 (file)
@@ -29,7 +29,7 @@ namespace System.Threading
 
         public object? ExceptionState => null;
 
-        internal ThreadAbortException(SerializationInfo info, StreamingContext context)
+        private ThreadAbortException(SerializationInfo info, StreamingContext context)
             : base(info, context)
         {
         }
index 4586746..a0f5d08 100644 (file)
@@ -53,7 +53,7 @@ namespace System
             HResult = HResults.COR_E_TYPEINITIALIZATION;
         }
 
-        internal TypeInitializationException(SerializationInfo info, StreamingContext context)
+        private TypeInitializationException(SerializationInfo info, StreamingContext context)
             : base(info, context)
         {
             _typeName = info.GetString("TypeName");
index b369a7a..ac90cf1 100644 (file)
@@ -31,7 +31,9 @@ namespace System
             info.AddValue("AssemblyName", string.Empty);
         }
 
+#pragma warning disable CA2229 // public for compat
         public UnitySerializationHolder(SerializationInfo info, StreamingContext context)
+#pragma warning restore CA2229
         {
             if (info == null)
             {
index 81c9ecc..73aac7f 100644 (file)
@@ -31,7 +31,7 @@ namespace System
             Create(target, trackResurrection);
         }
 
-        internal WeakReference(SerializationInfo info, StreamingContext context)
+        private WeakReference(SerializationInfo info, StreamingContext context)
         {
             if (info == null)
             {