diff options
Diffstat (limited to 'src/mscorlib/src/System/Text')
-rw-r--r-- | src/mscorlib/src/System/Text/DecoderBestFitFallback.cs | 1 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/DecoderExceptionFallback.cs | 3 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/DecoderFallback.cs | 1 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/DecoderNLS.cs | 16 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/DecoderReplacementFallback.cs | 1 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/EncoderBestFitFallback.cs | 1 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/EncoderExceptionFallback.cs | 6 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/EncoderFallback.cs | 1 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/EncoderNLS.cs | 17 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/EncoderReplacementFallback.cs | 1 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/Encoding.cs | 100 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/Latin1Encoding.cs | 25 | ||||
-rw-r--r-- | src/mscorlib/src/System/Text/UTF7Encoding.cs | 52 |
13 files changed, 16 insertions, 209 deletions
diff --git a/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs b/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs index ad88ef4400..f70213f8d6 100644 --- a/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs +++ b/src/mscorlib/src/System/Text/DecoderBestFitFallback.cs @@ -14,7 +14,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] internal sealed class InternalDecoderBestFitFallback : DecoderFallback { // Our variables diff --git a/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs b/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs index b98ef74ed2..7a8db572d0 100644 --- a/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs +++ b/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs @@ -8,7 +8,6 @@ using System.Globalization; namespace System.Text { - [Serializable] public sealed class DecoderExceptionFallback : DecoderFallback { // Construction @@ -99,7 +98,6 @@ namespace System.Text } // Exception for decoding unknown byte sequences. - [Serializable] public sealed class DecoderFallbackException : ArgumentException { private byte[] bytesUnknown = null; @@ -125,6 +123,7 @@ namespace System.Text internal DecoderFallbackException(SerializationInfo info, StreamingContext context) : base(info, context) { + throw new PlatformNotSupportedException(); } public DecoderFallbackException( diff --git a/src/mscorlib/src/System/Text/DecoderFallback.cs b/src/mscorlib/src/System/Text/DecoderFallback.cs index 9311cda585..2a56706b98 100644 --- a/src/mscorlib/src/System/Text/DecoderFallback.cs +++ b/src/mscorlib/src/System/Text/DecoderFallback.cs @@ -13,7 +13,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] public abstract class DecoderFallback { internal bool bIsMicrosoftBestFitFallback = false; diff --git a/src/mscorlib/src/System/Text/DecoderNLS.cs b/src/mscorlib/src/System/Text/DecoderNLS.cs index 6fcfc79140..c2791e9227 100644 --- a/src/mscorlib/src/System/Text/DecoderNLS.cs +++ b/src/mscorlib/src/System/Text/DecoderNLS.cs @@ -21,7 +21,6 @@ namespace System.Text // of Encoding objects. // - [Serializable] internal class DecoderNLS : Decoder, ISerializable { // Remember our encoding @@ -32,21 +31,10 @@ namespace System.Text #region Serialization - // Constructor called by serialization. called during deserialization. - internal DecoderNLS(SerializationInfo info, StreamingContext context) - { - throw new NotSupportedException( - String.Format( - System.Globalization.CultureInfo.CurrentCulture, - SR.NotSupported_TypeCannotDeserialized, this.GetType())); - } - - // ISerializable implementation. called during serialization. + // ISerializable implementation. void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - SerializeDecoder(info); - info.AddValue("encoding", this.m_encoding); - info.SetType(typeof(Encoding.DefaultDecoder)); + throw new PlatformNotSupportedException(); } #endregion Serialization diff --git a/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs b/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs index b27469156d..0eaca3de40 100644 --- a/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs +++ b/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs @@ -8,7 +8,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] public sealed class DecoderReplacementFallback : DecoderFallback { // Our variables diff --git a/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs b/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs index eb3165526b..b007f57efe 100644 --- a/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs +++ b/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs @@ -15,7 +15,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] internal sealed class InternalEncoderBestFitFallback : EncoderFallback { // Our variables diff --git a/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs b/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs index b75847d1e7..192ab78670 100644 --- a/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs +++ b/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs @@ -8,7 +8,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] public sealed class EncoderExceptionFallback : EncoderFallback { // Construction @@ -99,7 +98,6 @@ namespace System.Text } } - [Serializable] public sealed class EncoderFallbackException : ArgumentException { private char charUnknown; @@ -125,10 +123,6 @@ namespace System.Text HResult = __HResults.COR_E_ARGUMENT; } - internal EncoderFallbackException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - internal EncoderFallbackException( String message, char charUnknown, int index) : base(message) { diff --git a/src/mscorlib/src/System/Text/EncoderFallback.cs b/src/mscorlib/src/System/Text/EncoderFallback.cs index 410b6f5016..c3b9f47284 100644 --- a/src/mscorlib/src/System/Text/EncoderFallback.cs +++ b/src/mscorlib/src/System/Text/EncoderFallback.cs @@ -10,7 +10,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] public abstract class EncoderFallback { // disable csharp compiler warning #0414: field assigned unused value diff --git a/src/mscorlib/src/System/Text/EncoderNLS.cs b/src/mscorlib/src/System/Text/EncoderNLS.cs index 99a26ca575..8a8c31ee2f 100644 --- a/src/mscorlib/src/System/Text/EncoderNLS.cs +++ b/src/mscorlib/src/System/Text/EncoderNLS.cs @@ -21,7 +21,6 @@ namespace System.Text // of Encoding objects. // - [Serializable] internal class EncoderNLS : Encoder, ISerializable { // Need a place for the last left over character, most of our encodings use this @@ -35,22 +34,10 @@ namespace System.Text #region Serialization - // Constructor called by serialization. called during deserialization. - internal EncoderNLS(SerializationInfo info, StreamingContext context) - { - throw new NotSupportedException( - String.Format( - System.Globalization.CultureInfo.CurrentCulture, - SR.NotSupported_TypeCannotDeserialized, this.GetType())); - } - - // ISerializable implementation. called during serialization. + // ISerializable implementation. void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - SerializeEncoder(info); - info.AddValue("encoding", this.m_encoding); - info.AddValue("charLeftOver", this.charLeftOver); - info.SetType(typeof(Encoding.DefaultEncoder)); + throw new PlatformNotSupportedException(); } #endregion Serialization diff --git a/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs b/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs index 65b807c1bd..a9ce9c10ef 100644 --- a/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs +++ b/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs @@ -9,7 +9,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] public sealed class EncoderReplacementFallback : EncoderFallback { // Our variables diff --git a/src/mscorlib/src/System/Text/Encoding.cs b/src/mscorlib/src/System/Text/Encoding.cs index 159123495b..88eeb19d24 100644 --- a/src/mscorlib/src/System/Text/Encoding.cs +++ b/src/mscorlib/src/System/Text/Encoding.cs @@ -8,7 +8,6 @@ namespace System.Text using System.Collections; using System.Collections.Generic; using System.Runtime; - using System.Runtime.Remoting; using System.Runtime.Serialization; using System.Globalization; using System.Security; @@ -82,7 +81,6 @@ namespace System.Text // generally executes faster. // - [Serializable] public abstract class Encoding : ICloneable { // For netcore we use UTF8 as default encoding since ANSI isn't available @@ -1409,7 +1407,6 @@ namespace System.Text decoder.ClearMustFlush(); } - [Serializable] internal sealed class DefaultEncoder : Encoder, IObjectReference, ISerializable { private Encoding m_encoding; @@ -1422,60 +1419,16 @@ namespace System.Text m_encoding = encoding; m_hasInitializedEncoding = true; } - - // Constructor called by serialization, have to handle deserializing from Everett - internal DefaultEncoder(SerializationInfo info, StreamingContext context) - { - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // All we have is our encoding - m_encoding = (Encoding)info.GetValue("encoding", typeof(Encoding)); - - try - { - this.m_fallback = (EncoderFallback)info.GetValue("m_fallback", typeof(EncoderFallback)); - this.charLeftOver = (Char)info.GetValue("charLeftOver", typeof(Char)); - } - catch (SerializationException) - { - } - } - - // Just get it from GetEncoding + public Object GetRealObject(StreamingContext context) { - // upon deserialization since the DefaultEncoder implement IObjectReference the - // serialization code tries to do the fixup. The fixup returns another - // IObjectReference (the DefaultEncoder) class and hence so on and on. - // Finally the deserialization logics fails after following maximum references - // unless we short circuit with the following - if (m_hasInitializedEncoding) - { - return this; - } - - Encoder encoder = m_encoding.GetEncoder(); - if (m_fallback != null) - encoder.m_fallback = m_fallback; - if (charLeftOver != (char)0) - { - EncoderNLS encoderNls = encoder as EncoderNLS; - if (encoderNls != null) - encoderNls.charLeftOver = charLeftOver; - } - return encoder; + throw new PlatformNotSupportedException(); } // ISerializable implementation, get data for this object void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // All we have is our encoding - info.AddValue("encoding", m_encoding); + throw new PlatformNotSupportedException(); } // Returns the number of bytes the next call to GetBytes will @@ -1531,7 +1484,6 @@ namespace System.Text } } - [Serializable] internal sealed class DefaultDecoder : Decoder, IObjectReference, ISerializable { private Encoding m_encoding; @@ -1544,55 +1496,15 @@ namespace System.Text m_hasInitializedEncoding = true; } - // Constructor called by serialization, have to handle deserializing from Everett - internal DefaultDecoder(SerializationInfo info, StreamingContext context) - { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // All we have is our encoding - m_encoding = (Encoding)info.GetValue("encoding", typeof(Encoding)); - - try - { - this.m_fallback = (DecoderFallback)info.GetValue("m_fallback", typeof(DecoderFallback)); - } - catch (SerializationException) - { - m_fallback = null; - } - } - - // Just get it from GetEncoding public Object GetRealObject(StreamingContext context) { - // upon deserialization since the DefaultEncoder implement IObjectReference the - // serialization code tries to do the fixup. The fixup returns another - // IObjectReference (the DefaultEncoder) class and hence so on and on. - // Finally the deserialization logics fails after following maximum references - // unless we short circuit with the following - if (m_hasInitializedEncoding) - { - return this; - } - - Decoder decoder = m_encoding.GetDecoder(); - if (m_fallback != null) - decoder.m_fallback = m_fallback; - - return decoder; + throw new PlatformNotSupportedException(); } - // ISerializable implementation, get data for this object + // ISerializable implementation void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // All we have is our encoding - info.AddValue("encoding", m_encoding); + throw new PlatformNotSupportedException(); } // Returns the number of characters the next call to GetChars will diff --git a/src/mscorlib/src/System/Text/Latin1Encoding.cs b/src/mscorlib/src/System/Text/Latin1Encoding.cs index e456b8533d..3f040b29ad 100644 --- a/src/mscorlib/src/System/Text/Latin1Encoding.cs +++ b/src/mscorlib/src/System/Text/Latin1Encoding.cs @@ -18,7 +18,6 @@ namespace System.Text // Latin1Encoding is a simple override to optimize the GetString version of Latin1Encoding. // because of the best fit cases we can't do this when encoding the string, only when decoding // - [Serializable] internal class Latin1Encoding : EncodingNLS, ISerializable { // Used by Encoding.Latin1 for lazy initialization @@ -30,30 +29,10 @@ namespace System.Text { } - // Constructor called by serialization. - // Note: We use the base GetObjectData however - internal Latin1Encoding(SerializationInfo info, StreamingContext context) : - base(Encoding.ISO_8859_1) - { - // Set up our base, also throws if info was empty - DeserializeEncoding(info, context); - - // Nothing unique to Whidbey for Latin1 - } - - // ISerializable implementation, serialize it as a CodePageEncoding + // ISerializable implementation void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - // Make sure to get the base stuff too This throws if info is null - SerializeEncoding(info, context); - Debug.Assert(info != null, "[Latin1Encoding.GetObjectData] Expected null info to throw"); - - // In Everett this is a CodePageEncoding, so it needs maxCharSize - info.AddValue("CodePageEncoding+maxCharSize", 1); - - // And extras for Everett's wierdness - info.AddValue("CodePageEncoding+m_codePage", this.CodePage); - info.AddValue("CodePageEncoding+dataItem", null); + throw new PlatformNotSupportedException(); } // GetByteCount diff --git a/src/mscorlib/src/System/Text/UTF7Encoding.cs b/src/mscorlib/src/System/Text/UTF7Encoding.cs index 372af0da37..0ac3b66889 100644 --- a/src/mscorlib/src/System/Text/UTF7Encoding.cs +++ b/src/mscorlib/src/System/Text/UTF7Encoding.cs @@ -13,7 +13,6 @@ using System.Diagnostics.Contracts; namespace System.Text { - [Serializable] public class UTF7Encoding : Encoding { private const String base64Chars = @@ -832,7 +831,6 @@ namespace System.Text return charCount; } - [Serializable] // Of all the amazing things... This MUST be Decoder so that our com name // for System.Text.Decoder doesn't change private sealed class Decoder : DecoderNLS, ISerializable @@ -849,32 +847,10 @@ namespace System.Text // base calls reset } - // Constructor called by serialization, have to handle deserializing from Everett - internal Decoder(SerializationInfo info, StreamingContext context) - { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Get common info - this.bits = (int)info.GetValue("bits", typeof(int)); - this.bitCount = (int)info.GetValue("bitCount", typeof(int)); - this.firstByte = (bool)info.GetValue("firstByte", typeof(bool)); - this.m_encoding = (Encoding)info.GetValue("encoding", typeof(Encoding)); - } - // ISerializable implementation, get data for this object void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Save Whidbey data - info.AddValue("encoding", this.m_encoding); - info.AddValue("bits", this.bits); - info.AddValue("bitCount", this.bitCount); - info.AddValue("firstByte", this.firstByte); + throw new PlatformNotSupportedException(); } public override void Reset() @@ -898,7 +874,6 @@ namespace System.Text } } - [Serializable] // Of all the amazing things... This MUST be Encoder so that our com name // for System.Text.Encoder doesn't change private sealed class Encoder : EncoderNLS, ISerializable @@ -913,30 +888,10 @@ namespace System.Text // base calls reset } - // Constructor called by serialization, have to handle deserializing from Everett - internal Encoder(SerializationInfo info, StreamingContext context) - { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Get common info - this.bits = (int)info.GetValue("bits", typeof(int)); - this.bitCount = (int)info.GetValue("bitCount", typeof(int)); - this.m_encoding = (Encoding)info.GetValue("encoding", typeof(Encoding)); - } - - // ISerializable implementation, get data for this object + // ISerializable implementation void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { - // Any info? - if (info == null) throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - // Save Whidbey data - info.AddValue("encoding", this.m_encoding); - info.AddValue("bits", this.bits); - info.AddValue("bitCount", this.bitCount); + throw new PlatformNotSupportedException(); } public override void Reset() @@ -959,7 +914,6 @@ namespace System.Text // Preexisting UTF7 behavior for bad bytes was just to spit out the byte as the next char // and turn off base64 mode if it was in that mode. We still exit the mode, but now we fallback. - [Serializable] private sealed class DecoderUTF7Fallback : DecoderFallback { // Construction. Default replacement fallback uses no best fit and ? replacement string |