Delete DeserializationBlockedException (#25393)
authorJan Kotas <jkotas@microsoft.com>
Wed, 26 Jun 2019 00:24:40 +0000 (17:24 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Jun 2019 00:24:40 +0000 (17:24 -0700)
Contributes to dotnet/corefx#36723

src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems
src/System.Private.CoreLib/shared/System/Runtime/Serialization/DeserializationBlockedException.cs [deleted file]
src/System.Private.CoreLib/shared/System/Runtime/Serialization/SerializationInfo.cs

index 34dd829..0e914fc 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Loader\AssemblyLoadContext.cs" Condition="'$(TargetsCoreRT)' != 'true'" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Loader\LibraryNameVariation.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Remoting\ObjectHandle.cs" />
-    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\DeserializationBlockedException.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\DeserializationToken.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\DeserializationTracker.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\IDeserializationCallback.cs" />
diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Serialization/DeserializationBlockedException.cs b/src/System.Private.CoreLib/shared/System/Runtime/Serialization/DeserializationBlockedException.cs
deleted file mode 100644 (file)
index 232dc4d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.Serialization
-{
-    // Thrown when a dangerous action would be performed during deserialization 
-    [Serializable]
-    [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
-    public sealed class DeserializationBlockedException : SerializationException
-    {
-        // Creates a new DeserializationBlockedException with its message 
-        // string set to a default message.
-        public DeserializationBlockedException()
-            : base(SR.Serialization_DangerousDeserialization)
-        {
-            HResult = HResults.COR_E_SERIALIZATION;
-        }
-
-        // Creates a new DeserializationBlockedException with a message indicating an opt-out switch
-        // for a particular part of SerializationGuard
-        public DeserializationBlockedException(string? message)
-            : base(message)
-        {
-            HResult = HResults.COR_E_SERIALIZATION;
-        }
-
-        public DeserializationBlockedException(Exception? innerException)
-            : base(SR.Serialization_DangerousDeserialization, innerException)
-        {
-            HResult = HResults.COR_E_SERIALIZATION;
-        }
-
-        private DeserializationBlockedException(SerializationInfo info, StreamingContext context)
-            : base(info, context)
-        {
-        }
-    }
-}
index afcf0ed..a11fa94 100644 (file)
@@ -69,13 +69,13 @@ namespace System.Runtime.Serialization
             }
         }
 
-        // Throws a DeserializationBlockedException if dangerous deserialization is currently
+        // Throws a SerializationException if dangerous deserialization is currently
         // in progress
         public static void ThrowIfDeserializationInProgress()
         {
             if (DeserializationInProgress)
             {
-                throw new DeserializationBlockedException();
+                throw new SerializationException(SR.Serialization_DangerousDeserialization);
             }
         }
 
@@ -118,7 +118,7 @@ namespace System.Runtime.Serialization
             {
                 if (DeserializationInProgress)
                 {
-                    throw new DeserializationBlockedException(SR.Format(SR.Serialization_DangerousDeserialization_Switch, SwitchPrefix + switchSuffix));
+                    throw new SerializationException(SR.Format(SR.Serialization_DangerousDeserialization_Switch, SwitchPrefix + switchSuffix));
                 }
             }
             else