From 058b3ed152438e05ef795fcd7c97cb7ed389a7fb Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Wed, 23 Aug 2017 16:54:39 +0200 Subject: ConcurrentQueue --- .../Collections/Concurrent/ConcurrentQueue.cs | 29 ---------------------- 1 file changed, 29 deletions(-) (limited to 'src') diff --git a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs index fc2ce39a1d..3e83f5577a 100644 --- a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs +++ b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.Runtime.InteropServices; -using System.Runtime.Serialization; using System.Threading; namespace System.Collections.Concurrent @@ -53,16 +52,11 @@ namespace System.Collections.Concurrent /// Lock used to protect cross-segment operations, including any updates to or /// and any operations that need to get a consistent view of them. /// - [NonSerialized] private object _crossSegmentLock; /// The current tail segment. - [NonSerialized] private volatile Segment _tail; /// The current head segment. - [NonSerialized] private volatile Segment _head; - /// Field used to temporarily store the contents of the queue for serialization. - private T[] _serializationArray; /// /// Initializes a new instance of the class. @@ -73,29 +67,6 @@ namespace System.Collections.Concurrent _tail = _head = new Segment(InitialSegmentLength); } - /// Set the data array to be serialized. - [OnSerializing] - private void OnSerializing(StreamingContext context) - { - _serializationArray = ToArray(); - } - - /// Clear the data array that was serialized. - [OnSerialized] - private void OnSerialized(StreamingContext context) - { - _serializationArray = null; - } - - /// Construct the queue from the deserialized . - [OnDeserialized] - private void OnDeserialized(StreamingContext context) - { - Debug.Assert(_serializationArray != null); - InitializeFromCollection(_serializationArray); - _serializationArray = null; - } - /// /// Initializes the contents of the queue from an existing collection. /// -- cgit v1.2.3 From 435f5420e7df4f2ef77c9beca6bdafa5fc976d30 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 24 Aug 2017 18:29:57 +0200 Subject: IO --- src/mscorlib/src/System/IO/MemoryStream.cs | 1 - src/mscorlib/src/System/IO/Stream.cs | 2 -- src/mscorlib/src/System/IO/StreamReader.cs | 14 +++++--------- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src') 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 _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 { -- cgit v1.2.3 From e466788c35fcf8cbb3fca4320824ad83530b7927 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 7 Sep 2017 19:28:18 +0200 Subject: Reflection --- src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs | 8 +------- src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs | 8 -------- 2 files changed, 1 insertion(+), 15 deletions(-) (limited to 'src') 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 8c07d8f397..967ecae923 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 -- cgit v1.2.3 From 1fffec5ee9fcb838c6b71ae8b755406e098c9671 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Thu, 7 Sep 2017 21:21:45 +0200 Subject: TextInfo --- .../src/System/Globalization/TextInfo.Unix.cs | 1 - src/mscorlib/src/System/Globalization/TextInfo.cs | 34 +++++----------------- 2 files changed, 8 insertions(+), 27 deletions(-) (limited to 'src') 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 -- cgit v1.2.3 From 08e37bb669254df8667888ef5171603cdd1a6988 Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Tue, 12 Sep 2017 11:09:40 +0200 Subject: ResourceSet --- src/mscorlib/src/System/Resources/ResourceSet.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') 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. -- cgit v1.2.3