diff options
author | Viktor Hofer <viktor.hofer@microsoft.com> | 2017-09-12 18:45:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-12 18:45:42 +0200 |
commit | 33851edeb866368d0c5f7122d6419dec9cabff43 (patch) | |
tree | d6b3453be98ca9ea9964c63fad5f32c47b74bb2e /src | |
parent | 3297fd43b6d78c025e3befa3b6242229deaa9094 (diff) | |
parent | 08e37bb669254df8667888ef5171603cdd1a6988 (diff) | |
download | coreclr-33851edeb866368d0c5f7122d6419dec9cabff43.tar.gz coreclr-33851edeb866368d0c5f7122d6419dec9cabff43.tar.bz2 coreclr-33851edeb866368d0c5f7122d6419dec9cabff43.zip |
Merge pull request #13242 from ViktorHofer/BinarySerializationCleanup
Binary serialization unused methods and attributes cleanup and misc code cleanup
Diffstat (limited to 'src')
8 files changed, 15 insertions, 61 deletions
diff --git a/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs b/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs index f7f64c684a..9f80d73891 100644 --- a/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs +++ b/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs @@ -11,7 +11,6 @@ namespace System.Globalization { public partial class TextInfo { - [NonSerialized] private Tristate _needsTurkishCasing = Tristate.NotInitialized; private void FinishInitialization(string textInfoName) diff --git a/src/mscorlib/src/System/Globalization/TextInfo.cs b/src/mscorlib/src/System/Globalization/TextInfo.cs index ecc2108ce3..c5acbd4579 100644 --- a/src/mscorlib/src/System/Globalization/TextInfo.cs +++ b/src/mscorlib/src/System/Globalization/TextInfo.cs @@ -21,10 +21,6 @@ namespace System.Globalization { public partial class TextInfo : ICloneable, IDeserializationCallback { - ////--------------------------------------------------------------------// - //// Internal Information // - ////--------------------------------------------------------------------// - private enum Tristate : byte { NotInitialized, @@ -32,36 +28,22 @@ namespace System.Globalization False, } - //// - //// Variables. - //// - - [OptionalField(VersionAdded = 2)] - private String _listSeparator; - [OptionalField(VersionAdded = 2)] + private string _listSeparator; private bool _isReadOnly = false; - //// _cultureName is the name of the creating culture. Note that we consider this authoritative, - //// if the culture's textinfo changes when deserializing, then behavior may change. - //// (ala Whidbey behavior). This is the only string Arrowhead needs to serialize. - //// _cultureData is the data that backs this class. - //// _textInfoName is the actual name of the textInfo (from cultureData.STEXTINFO) - //// this can be the same as _cultureName on Silverlight since the OS knows - //// how to do the sorting. However in the desktop, when we call the sorting dll, it doesn't - //// know how to resolve custom locale names to sort ids so we have to have already resolved this. - //// - - [OptionalField(VersionAdded = 3)] + /* _cultureName is the name of the creating culture. + _cultureData is the data that backs this class. + _textInfoName is the actual name of the textInfo (from cultureData.STEXTINFO) + In the desktop, when we call the sorting dll, it doesn't + know how to resolve custom locle names to sort ids so we have to have already resolved this. + */ + private String _cultureName; // Name of the culture that created this text info - [NonSerialized] private CultureData _cultureData; // Data record for the culture that made us, not for this textinfo - [NonSerialized] private String _textInfoName; // Name of the text info we're using (ie: _cultureData.STEXTINFO) - [NonSerialized] private Tristate _isAsciiCasingSameAsInvariant = Tristate.NotInitialized; // _invariantMode is defined for the perf reason as accessing the instance field is faster than access the static property GlobalizationMode.Invariant - [NonSerialized] private readonly bool _invariantMode = GlobalizationMode.Invariant; // Invariant text info diff --git a/src/mscorlib/src/System/IO/MemoryStream.cs b/src/mscorlib/src/System/IO/MemoryStream.cs index d97d3f4c8f..2ac7c07db4 100644 --- a/src/mscorlib/src/System/IO/MemoryStream.cs +++ b/src/mscorlib/src/System/IO/MemoryStream.cs @@ -49,7 +49,6 @@ namespace System.IO private bool _exposable; // Whether the array can be returned to the user. private bool _isOpen; // Is this stream open or closed? - [NonSerialized] private Task<int> _lastReadTask; // The last successful task returned from ReadAsync private const int MemStreamMaxLength = Int32.MaxValue; diff --git a/src/mscorlib/src/System/IO/Stream.cs b/src/mscorlib/src/System/IO/Stream.cs index ae8ca517c4..82fad24c6d 100644 --- a/src/mscorlib/src/System/IO/Stream.cs +++ b/src/mscorlib/src/System/IO/Stream.cs @@ -41,9 +41,7 @@ namespace System.IO // To implement Async IO operations on streams that don't support async IO - [NonSerialized] private ReadWriteTask _activeReadWriteTask; - [NonSerialized] private SemaphoreSlim _asyncActiveSemaphore; internal SemaphoreSlim EnsureAsyncActiveSemaphoreInitialized() diff --git a/src/mscorlib/src/System/IO/StreamReader.cs b/src/mscorlib/src/System/IO/StreamReader.cs index 1fc72bffd1..9ff9187663 100644 --- a/src/mscorlib/src/System/IO/StreamReader.cs +++ b/src/mscorlib/src/System/IO/StreamReader.cs @@ -58,7 +58,6 @@ namespace System.IO // This is used only for preamble detection private int bytePos; - [NonSerialized] private StringBuilder _builder; // This is the maximum number of chars we can get from one call to @@ -84,14 +83,12 @@ namespace System.IO private bool _isBlocked; // The intent of this field is to leave open the underlying stream when - // disposing of this StreamReader. A name like _leaveOpen is better, - // but this type is serializable, and this field's name was _closable. - private bool _closable; // Whether to close the underlying stream. + // disposing of this StreamReader. + private bool _leaveOpen; // Whether to keep the underlying stream open. // We don't guarantee thread safety on StreamReader, but we should at // least prevent users from trying to read anything while an Async // read from the same thread is in progress. - [NonSerialized] private volatile Task _asyncReadTask; private void CheckAsyncTaskInProgress() @@ -216,14 +213,14 @@ namespace System.IO _checkPreamble = (_preamble.Length > 0); _isBlocked = false; - _closable = !leaveOpen; + _leaveOpen = leaveOpen; } // Init used by NullStreamReader, to delay load encoding internal void Init(Stream stream) { this.stream = stream; - _closable = true; + _leaveOpen = false; } public override void Close() @@ -265,7 +262,7 @@ namespace System.IO } internal bool LeaveOpen { - get { return !_closable; } + get { return _leaveOpen; } } // DiscardBufferedData tells StreamReader to throw away its internal @@ -1145,7 +1142,6 @@ namespace System.IO } #endregion - // No data, class doesn't need to be serializable. // Note this class is threadsafe. private class NullStreamReader : StreamReader { diff --git a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs index 4a9b774d15..c597dbe6b4 100644 --- a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs +++ b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs @@ -2,10 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// -// - using System; using System.Diagnostics; using System.Diagnostics.Contracts; @@ -55,9 +51,7 @@ namespace System.Reflection.Emit internal String m_strFileName; internal bool m_fGlobalBeenCreated; internal bool m_fHasGlobal; - [NonSerialized] internal TypeBuilder m_globalTypeBuilder; - [NonSerialized] internal ModuleBuilder m_module; private int m_tkFile; @@ -65,5 +59,5 @@ namespace System.Reflection.Emit internal const String MULTI_BYTE_VALUE_CLASS = "$ArrayType$"; internal String m_strResourceFileName; internal byte[] m_resourceBytes; - } // class ModuleBuilderData + } } diff --git a/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs b/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs index d61c70bd0d..8f070b6827 100644 --- a/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs +++ b/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs @@ -118,20 +118,12 @@ namespace System.Reflection #endregion #region Private Data Members - // These are new in Whidbey, so we cannot serialize them directly or we break backwards compatibility. - [NonSerialized] private int m_tkParamDef; - [NonSerialized] private MetadataImport m_scope; - [NonSerialized] private Signature m_signature; - [NonSerialized] private volatile bool m_nameIsCached = false; - [NonSerialized] private readonly bool m_noMetadata = false; - [NonSerialized] private bool m_noDefaultValue = false; - [NonSerialized] private MethodBase m_originalMember = null; #endregion diff --git a/src/mscorlib/src/System/Resources/ResourceSet.cs b/src/mscorlib/src/System/Resources/ResourceSet.cs index b4029a7e9c..deb9763d5d 100644 --- a/src/mscorlib/src/System/Resources/ResourceSet.cs +++ b/src/mscorlib/src/System/Resources/ResourceSet.cs @@ -13,16 +13,10 @@ ** ===========================================================*/ -using System; using System.Collections; using System.IO; -using System.Globalization; -using System.Runtime.InteropServices; using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Versioning; using System.Diagnostics.Contracts; -using System.Collections.Generic; namespace System.Resources { @@ -34,7 +28,7 @@ namespace System.Resources // public class ResourceSet : IDisposable, IEnumerable { - [NonSerialized] protected IResourceReader Reader; + protected IResourceReader Reader; internal Hashtable Table; private Hashtable _caseInsensitiveTable; // For case-insensitive lookups. |