Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2016-09-01 19:44:09 +0300
committerGitHub <noreply@github.com>2016-09-01 19:44:09 +0300
commitb9a615433b4093ff3326adf6bcdf20333fcc025c (patch)
tree37f3527b1c5d987e10a36d68afcffee6e48cdc0b
parentd596b8ccc275cbab97b4e23132ae33720fb2a087 (diff)
parentd37ded60eee403b1cfa425c5e4bbdd71f7e4bcbe (diff)
Merge pull request #11312 from stephentoub/more_serializable
Make some more corefx types serializable
-rw-r--r--src/Common/src/System/NonSerializedAttribute.cs4
-rw-r--r--src/Common/src/System/Runtime/Serialization/IDeserializationCallback.cs11
-rw-r--r--src/Common/src/System/Runtime/Serialization/IFormatterConverter.cs32
-rw-r--r--src/Common/src/System/Runtime/Serialization/IObjectReference.cs11
-rw-r--r--src/Common/src/System/Runtime/Serialization/ISerializable.cs11
-rw-r--r--src/Common/src/System/Runtime/Serialization/OptionalFieldAttribute.cs25
-rw-r--r--src/Common/src/System/Runtime/Serialization/SerializationInfo.cs472
-rw-r--r--src/Common/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs127
-rw-r--r--src/Common/src/System/SerializableAttribute.cs2
-rw-r--r--src/System.Console/src/System.Console.csproj5
-rw-r--r--src/System.Console/src/System/ConsoleCancelEventArgs.cs1
-rw-r--r--src/System.Console/src/System/ConsoleColor.cs1
-rw-r--r--src/System.Console/src/System/ConsoleKey.cs1
-rw-r--r--src/System.Console/src/System/ConsoleKeyInfo.cs1
-rw-r--r--src/System.Console/src/System/ConsoleModifiers.cs1
-rw-r--r--src/System.Console/src/System/ConsoleSpecialKey.cs1
-rw-r--r--src/System.Console/src/System/IO/SyncTextReader.cs1
-rw-r--r--src/System.Console/src/System/IO/SyncTextWriter.cs1
-rw-r--r--src/System.Console/src/project.json2
-rw-r--r--src/System.IO.Compression/src/System.IO.Compression.csproj3
-rw-r--r--src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs35
-rw-r--r--src/System.IO.Compression/src/System/IO/Compression/ZLibException.cs8
-rw-r--r--src/System.IO.Compression/src/project.json2
-rw-r--r--src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.cs1
-rw-r--r--src/System.IO.IsolatedStorage/src/ApiCompatBaseline.uap101.txt3
-rw-r--r--src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj3
-rw-r--r--src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs17
-rw-r--r--src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.cs2
-rw-r--r--src/System.Runtime.Serialization.Formatters/src/System/TemporaryStubs.cs3
-rw-r--r--src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs2
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj15
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs18
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.cs5
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnDeserializedAttribute.cs (renamed from src/Common/src/System/Runtime/Serialization/OnDeserializedAttribute.cs)0
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnDeserializingAttribute.cs (renamed from src/Common/src/System/Runtime/Serialization/OnDeserializingAttribute.cs)0
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnSerializedAttribute.cs (renamed from src/Common/src/System/Runtime/Serialization/OnSerializedAttribute.cs)0
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnSerializingAttribute.cs (renamed from src/Common/src/System/Runtime/Serialization/OnSerializingAttribute.cs)0
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/SerializationException.cs (renamed from src/Common/src/System/Runtime/Serialization/SerializationException.cs)0
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/StreamingContext.cs (renamed from src/Common/src/System/Runtime/Serialization/StreamingContext.cs)0
-rw-r--r--src/System.Runtime.Serialization.Primitives/src/project.json2
-rw-r--r--src/System.Runtime/src/System.Runtime.csproj49
-rw-r--r--src/System.Runtime/src/System/LazyOfTTMetadata.cs1
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj8
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs6
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs14
-rw-r--r--src/System.Security.Cryptography.Algorithms/src/project.json2
-rw-r--r--src/System.Transactions/src/System/Transactions/DistributedTransaction.cs28
47 files changed, 166 insertions, 771 deletions
diff --git a/src/Common/src/System/NonSerializedAttribute.cs b/src/Common/src/System/NonSerializedAttribute.cs
index 8fe484e5b9..9654732030 100644
--- a/src/Common/src/System/NonSerializedAttribute.cs
+++ b/src/Common/src/System/NonSerializedAttribute.cs
@@ -5,10 +5,10 @@
namespace System
{
[AttributeUsage(AttributeTargets.Field, Inherited = false)]
- public sealed class NonSerializedAttribute : Attribute
+ internal sealed class NonSerializedAttribute : Attribute
{
public NonSerializedAttribute()
{
}
}
-} \ No newline at end of file
+}
diff --git a/src/Common/src/System/Runtime/Serialization/IDeserializationCallback.cs b/src/Common/src/System/Runtime/Serialization/IDeserializationCallback.cs
deleted file mode 100644
index c4b5089782..0000000000
--- a/src/Common/src/System/Runtime/Serialization/IDeserializationCallback.cs
+++ /dev/null
@@ -1,11 +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
-{
- public interface IDeserializationCallback
- {
- void OnDeserialization(object sender);
- }
-} \ No newline at end of file
diff --git a/src/Common/src/System/Runtime/Serialization/IFormatterConverter.cs b/src/Common/src/System/Runtime/Serialization/IFormatterConverter.cs
deleted file mode 100644
index ac9c3d8255..0000000000
--- a/src/Common/src/System/Runtime/Serialization/IFormatterConverter.cs
+++ /dev/null
@@ -1,32 +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
-{
- [CLSCompliant(false)]
- public interface IFormatterConverter
- {
- object Convert(object value, Type type);
- object Convert(object value, TypeCode typeCode);
- bool ToBoolean(object value);
- char ToChar(object value);
- [CLSCompliant(false)]
- sbyte ToSByte(object value);
- byte ToByte(object value);
- short ToInt16(object value);
- [CLSCompliant(false)]
- ushort ToUInt16(object value);
- int ToInt32(object value);
- [CLSCompliant(false)]
- uint ToUInt32(object value);
- long ToInt64(object value);
- [CLSCompliant(false)]
- ulong ToUInt64(object value);
- float ToSingle(object value);
- double ToDouble(object value);
- decimal ToDecimal(object value);
- DateTime ToDateTime(object value);
- string ToString(object value);
- }
-}
diff --git a/src/Common/src/System/Runtime/Serialization/IObjectReference.cs b/src/Common/src/System/Runtime/Serialization/IObjectReference.cs
deleted file mode 100644
index d41bc50dde..0000000000
--- a/src/Common/src/System/Runtime/Serialization/IObjectReference.cs
+++ /dev/null
@@ -1,11 +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
-{
- public interface IObjectReference
- {
- object GetRealObject(StreamingContext context);
- }
-}
diff --git a/src/Common/src/System/Runtime/Serialization/ISerializable.cs b/src/Common/src/System/Runtime/Serialization/ISerializable.cs
deleted file mode 100644
index 383b3f07af..0000000000
--- a/src/Common/src/System/Runtime/Serialization/ISerializable.cs
+++ /dev/null
@@ -1,11 +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
-{
- public interface ISerializable
- {
- void GetObjectData(SerializationInfo info, StreamingContext context);
- }
-}
diff --git a/src/Common/src/System/Runtime/Serialization/OptionalFieldAttribute.cs b/src/Common/src/System/Runtime/Serialization/OptionalFieldAttribute.cs
deleted file mode 100644
index 5f22ee669a..0000000000
--- a/src/Common/src/System/Runtime/Serialization/OptionalFieldAttribute.cs
+++ /dev/null
@@ -1,25 +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
-{
- [AttributeUsage(AttributeTargets.Field, Inherited = false)]
- public sealed class OptionalFieldAttribute : Attribute
- {
- private int _versionAdded = 1;
-
- public int VersionAdded
- {
- get { return _versionAdded; }
- set
- {
- if (value < 1)
- {
- throw new ArgumentException("Version value must be positive."); // TODO: SR.Serialization_OptionalFieldVersionValue);
- }
- _versionAdded = value;
- }
- }
- }
-}
diff --git a/src/Common/src/System/Runtime/Serialization/SerializationInfo.cs b/src/Common/src/System/Runtime/Serialization/SerializationInfo.cs
deleted file mode 100644
index 0546660410..0000000000
--- a/src/Common/src/System/Runtime/Serialization/SerializationInfo.cs
+++ /dev/null
@@ -1,472 +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.
-
-using System.Collections.Generic;
-using System.Reflection;
-
-// TODO: Put back asserts once Debug.Assert is available
-
-namespace System.Runtime.Serialization
-{
- public sealed class SerializationInfo
- {
- private const int DefaultSize = 4;
-
- // Even though we have a dictionary, we're still keeping all the arrays around for back-compat.
- // Otherwise we may run into potentially breaking behaviors like GetEnumerator() not returning entries in the same order they were added.
- private string[] _names;
- private object[] _values;
- private Type[] _types;
- private int _count;
- private Dictionary<string, int> _nameToIndex;
-
- private IFormatterConverter _converter;
- private string _rootTypeName;
- private string _rootTypeAssemblyName;
- private Type _rootType;
-
- [CLSCompliant(false)]
- public SerializationInfo(Type type, IFormatterConverter converter)
- {
- if (type == null)
- {
- throw new ArgumentNullException(nameof(type));
- }
- if (converter == null)
- {
- throw new ArgumentNullException(nameof(converter));
- }
-
- _rootType = type;
- _rootTypeName = type.FullName;
- _rootTypeAssemblyName = type.GetTypeInfo().Module.Assembly.FullName;
-
- _names = new string[DefaultSize];
- _values = new object[DefaultSize];
- _types = new Type[DefaultSize];
- _nameToIndex = new Dictionary<string, int>();
- _converter = converter;
- }
-
- public string FullTypeName
- {
- get { return _rootTypeName; }
- set
- {
- if (null == value)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- _rootTypeName = value;
- IsFullTypeNameSetExplicit = true;
- }
- }
-
- public string AssemblyName
- {
- get { return _rootTypeAssemblyName; }
- set
- {
- if (null == value)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- _rootTypeAssemblyName = value;
- IsAssemblyNameSetExplicit = true;
- }
- }
-
- public bool IsFullTypeNameSetExplicit { get; private set; }
-
- public bool IsAssemblyNameSetExplicit { get; private set; }
-
- public void SetType(Type type)
- {
- if (type == null)
- {
- throw new ArgumentNullException(nameof(type));
- }
-
- if (!ReferenceEquals(_rootType, type))
- {
- _rootType = type;
- _rootTypeName = type.FullName;
- _rootTypeAssemblyName = type.GetTypeInfo().Module.Assembly.FullName;
- IsFullTypeNameSetExplicit = false;
- IsAssemblyNameSetExplicit = false;
- }
- }
-
- public int MemberCount => _count;
-
- public Type ObjectType => _rootType;
-
- public SerializationInfoEnumerator GetEnumerator() => new SerializationInfoEnumerator(_names, _values, _types, _count);
-
- private void ExpandArrays()
- {
- int newSize;
- // Debug.Assert(_names.Length == _count);
-
- newSize = (_count * 2);
-
- // In the pathological case, we may wrap
- if (newSize < _count)
- {
- if (int.MaxValue > _count)
- {
- newSize = int.MaxValue;
- }
- }
-
- // Allocate more space and copy the data
-
- string[] newMembers = new string[newSize];
- Array.Copy(_names, 0, newMembers, 0, _count);
- _names = newMembers;
-
- object[] newData = new object[newSize];
- Array.Copy(_values, 0, newData, 0, _count);
- _values = newData;
-
- Type[] newTypes = new Type[newSize];
- Array.Copy(_types, 0, newTypes, 0, _count);
- _types = newTypes;
- }
-
- internal void UpdateValue(string name, object value, Type type)
- {
- //Debug.Assert(null != name, "[SerializationInfo.UpdateValue]name!=null");
- //Debug.Assert(null != value, "[SerializationInfo.UpdateValue]value!=null");
- //Debug.Assert(null != type, "[SerializationInfo.UpdateValue]type!=null");
-
- int index = FindElement(name);
- if (index < 0)
- {
- AddValueInternal(name, value, type);
- }
- else
- {
- _values[index] = value;
- _types[index] = type;
- }
- }
-
- public void AddValue(string name, object value, Type type)
- {
- if (null == name)
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- if (type == null)
- {
- throw new ArgumentNullException(nameof(type));
- }
-
- AddValueInternal(name, value, type);
- }
-
- public void AddValue(string name, object value)
- {
- if (null == value)
- {
- AddValue(name, value, typeof(object));
- }
- else
- {
- AddValue(name, value, value.GetType());
- }
- }
-
- public void AddValue(string name, bool value)
- {
- AddValue(name, value, typeof(bool));
- }
-
- public void AddValue(string name, char value)
- {
- AddValue(name, value, typeof(char));
- }
-
- [CLSCompliant(false)]
- public void AddValue(string name, sbyte value)
- {
- AddValue(name, value, typeof(sbyte));
- }
-
- public void AddValue(string name, byte value)
- {
- AddValue(name, value, typeof(byte));
- }
-
- public void AddValue(string name, short value)
- {
- AddValue(name, value, typeof(short));
- }
-
- [CLSCompliant(false)]
- public void AddValue(string name, ushort value)
- {
- AddValue(name, value, typeof(ushort));
- }
-
- public void AddValue(string name, int value)
- {
- AddValue(name, value, typeof(int));
- }
-
- [CLSCompliant(false)]
- public void AddValue(string name, uint value)
- {
- AddValue(name, value, typeof(uint));
- }
-
- public void AddValue(string name, long value)
- {
- AddValue(name, value, typeof(long));
- }
-
- [CLSCompliant(false)]
- public void AddValue(string name, ulong value)
- {
- AddValue(name, value, typeof(ulong));
- }
-
- public void AddValue(string name, float value)
- {
- AddValue(name, value, typeof(float));
- }
-
- public void AddValue(string name, double value)
- {
- AddValue(name, value, typeof(double));
- }
-
- public void AddValue(string name, decimal value)
- {
- AddValue(name, value, typeof(decimal));
- }
-
- public void AddValue(string name, DateTime value)
- {
- AddValue(name, value, typeof(DateTime));
- }
-
- internal void AddValueInternal(string name, object value, Type type)
- {
- if (_nameToIndex.ContainsKey(name))
- {
- throw new SerializationException("Cannot add the same member twice to a SerializationInfo object."); // TODO: SR.Serialization_SameNameTwice);
- }
- _nameToIndex.Add(name, _count);
-
- // If we need to expand the arrays, do so.
- if (_count >= _names.Length)
- {
- ExpandArrays();
- }
-
- // Add the data and then advance the counter.
- _names[_count] = name;
- _values[_count] = value;
- _types[_count] = type;
- _count++;
- }
-
- private int FindElement(string name)
- {
- if (null == name)
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- int index;
- return _nameToIndex.TryGetValue(name, out index) ? index : -1;
- }
-
- private object GetElement(string name, out Type foundType)
- {
- int index = FindElement(name);
- if (index == -1)
- {
- throw new SerializationException(string.Format("Member '{0}' was not found.", name)); // TODO: SR.Format(SR.Serialization_NotFound, name));
- }
-
- //Debug.Assert(index < _values.Length);
- //Debug.Assert(index < _types.Length);
-
- foundType = _types[index];
- //Debug.Assert(foundType != null);
- return _values[index];
- }
-
- private object GetElementNoThrow(string name, out Type foundType)
- {
- int index = FindElement(name);
- if (index == -1)
- {
- foundType = null;
- return null;
- }
-
- //Debug.Assert(index < _values.Length, "[SerializationInfo.GetElement]index<m_data.Length");
- //Debug.Assert(index < _types.Length, "[SerializationInfo.GetElement]index<m_types.Length");
-
- foundType = _types[index];
- //Debug.Assert(foundType != null, "[SerializationInfo.GetElement]foundType!=null");
- return _values[index];
- }
-
- public object GetValue(string name, Type type)
- {
- if (type == null)
- {
- throw new ArgumentNullException(nameof(type));
- }
-
- Type foundType;
- object value;
-
- value = GetElement(name, out foundType);
- if (ReferenceEquals(foundType, type) || type.GetTypeInfo().IsAssignableFrom(foundType.GetTypeInfo()) || value == null)
- {
- return value;
- }
-
- //Debug.Assert(_converter != null);
- return _converter.Convert(value, type);
- }
-
- internal object GetValueNoThrow(string name, Type type)
- {
- //Debug.Assert(type != null, "[SerializationInfo.GetValue]type ==null");
-
- Type foundType;
- object value = GetElementNoThrow(name, out foundType);
- if (value == null)
- return null;
-
- if (ReferenceEquals(foundType, type) || type.IsAssignableFrom(foundType) || value == null)
- {
- return value;
- }
-
- //Debug.Assert(_converter != null, "[SerializationInfo.GetValue]m_converter!=null");
- return _converter.Convert(value, type);
- }
-
- public bool GetBoolean(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(bool)) ? (bool)value : _converter.ToBoolean(value);
- }
-
- public char GetChar(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(char)) ? (char)value : _converter.ToChar(value);
- }
-
- [CLSCompliant(false)]
- public sbyte GetSByte(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(sbyte)) ? (sbyte)value : _converter.ToSByte(value);
- }
-
- public byte GetByte(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(byte)) ? (byte)value : _converter.ToByte(value);
- }
-
- public short GetInt16(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(short)) ? (short)value : _converter.ToInt16(value);
- }
-
- [CLSCompliant(false)]
- public ushort GetUInt16(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(ushort)) ? (ushort)value : _converter.ToUInt16(value);
- }
-
- public int GetInt32(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(int)) ? (int)value : _converter.ToInt32(value);
- }
-
- [CLSCompliant(false)]
- public uint GetUInt32(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(uint)) ? (uint)value : _converter.ToUInt32(value);
- }
-
- public long GetInt64(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(long)) ? (long)value : _converter.ToInt64(value);
- }
-
- [CLSCompliant(false)]
- public ulong GetUInt64(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(ulong)) ? (ulong)value : _converter.ToUInt64(value);
- }
-
- public float GetSingle(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(float)) ? (float)value : _converter.ToSingle(value);
- }
-
-
- public double GetDouble(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(double)) ? (double)value : _converter.ToDouble(value);
- }
-
- public decimal GetDecimal(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(decimal)) ? (decimal)value : _converter.ToDecimal(value);
- }
-
- public DateTime GetDateTime(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(DateTime)) ? (DateTime)value : _converter.ToDateTime(value);
- }
-
- public string GetString(string name)
- {
- Type foundType;
- object value = GetElement(name, out foundType);
- return ReferenceEquals(foundType, typeof(string)) || value == null ? (string)value : _converter.ToString(value);
- }
- }
-}
diff --git a/src/Common/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs b/src/Common/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs
deleted file mode 100644
index ae95751ff8..0000000000
--- a/src/Common/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs
+++ /dev/null
@@ -1,127 +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.
-
-using System.Collections;
-
-namespace System.Runtime.Serialization
-{
- public struct SerializationEntry
- {
- private string _name;
- private object _value;
- private Type _type;
-
- internal SerializationEntry(string entryName, object entryValue, Type entryType)
- {
- _name = entryName;
- _value = entryValue;
- _type = entryType;
- }
-
- public object Value => _value;
- public string Name => _name;
- public Type ObjectType => _type;
- }
-
- public sealed class SerializationInfoEnumerator : IEnumerator
- {
- private readonly string[] _members;
- private readonly object[] _data;
- private readonly Type[] _types;
- private readonly int _numItems;
- private int _currItem;
- private bool _current;
-
- internal SerializationInfoEnumerator(string[] members, object[] info, Type[] types, int numItems)
- {
- // TODO: Put back asserts once Debug.Assert is available
- //Debug.Assert(members != null, "[SerializationInfoEnumerator.ctor]members!=null");
- //Debug.Assert(info != null, "[SerializationInfoEnumerator.ctor]info!=null");
- //Debug.Assert(types != null, "[SerializationInfoEnumerator.ctor]types!=null");
- //Debug.Assert(numItems >= 0, "[SerializationInfoEnumerator.ctor]numItems>=0");
- //Debug.Assert(members.Length >= numItems, "[SerializationInfoEnumerator.ctor]members.Length>=numItems");
- //Debug.Assert(info.Length >= numItems, "[SerializationInfoEnumerator.ctor]info.Length>=numItems");
- //Debug.Assert(types.Length >= numItems, "[SerializationInfoEnumerator.ctor]types.Length>=numItems");
-
- _members = members;
- _data = info;
- _types = types;
-
- //The MoveNext semantic is much easier if we enforce that [0..m_numItems] are valid entries
- //in the enumerator, hence we subtract 1.
- _numItems = numItems - 1;
- _currItem = -1;
- _current = false;
- }
-
- public bool MoveNext()
- {
- if (_currItem < _numItems)
- {
- _currItem++;
- _current = true;
- }
- else
- {
- _current = false;
- }
-
- return _current;
- }
-
- object IEnumerator.Current => Current;
-
- public SerializationEntry Current
- {
- get
- {
- if (_current == false)
- {
- throw new InvalidOperationException("Enumeration has either not started or has already finished."); // TODO: SR.InvalidOperation_EnumOpCantHappen);
- }
- return new SerializationEntry(_members[_currItem], _data[_currItem], _types[_currItem]);
- }
- }
-
- public void Reset()
- {
- _currItem = -1;
- _current = false;
- }
-
- public string Name
- {
- get
- {
- if (_current == false)
- {
- throw new InvalidOperationException("Enumeration has either not started or has already finished."); // TODO: SR.InvalidOperation_EnumOpCantHappen);
- }
- return _members[_currItem];
- }
- }
- public object Value
- {
- get
- {
- if (_current == false)
- {
- throw new InvalidOperationException("Enumeration has either not started or has already finished."); // TODO: SR.InvalidOperation_EnumOpCantHappen);
- }
- return _data[_currItem];
- }
- }
- public Type ObjectType
- {
- get
- {
- if (_current == false)
- {
- throw new InvalidOperationException("Enumeration has either not started or has already finished."); // TODO: SR.InvalidOperation_EnumOpCantHappen);
- }
- return _types[_currItem];
- }
- }
- }
-}
diff --git a/src/Common/src/System/SerializableAttribute.cs b/src/Common/src/System/SerializableAttribute.cs
index c256931373..f7e172cd1b 100644
--- a/src/Common/src/System/SerializableAttribute.cs
+++ b/src/Common/src/System/SerializableAttribute.cs
@@ -5,7 +5,7 @@
namespace System
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)]
- public sealed class SerializableAttribute : Attribute
+ internal sealed class SerializableAttribute : Attribute
{
public SerializableAttribute() { }
}
diff --git a/src/System.Console/src/System.Console.csproj b/src/System.Console/src/System.Console.csproj
index 187b91f8a2..1c458b7e78 100644
--- a/src/System.Console/src/System.Console.csproj
+++ b/src/System.Console/src/System.Console.csproj
@@ -266,6 +266,11 @@
<Link>Common\Interop\Unix\Interop.StdinReady.cs"</Link>
</Compile>
</ItemGroup>
+ <ItemGroup Condition="'$(TargetGroup)'=='netstandard1.3' Or '$(TargetGroup)' == 'netcore50'">
+ <Compile Include="$(CommonPath)\System\SerializableAttribute.cs">
+ <Link>Common\System\SerializableAttribute.cs"</Link>
+ </Compile>
+ </ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'net46' OR '$(TargetGroup)' == 'net463'">
<TargetingPackReference Include="mscorlib" />
</ItemGroup>
diff --git a/src/System.Console/src/System/ConsoleCancelEventArgs.cs b/src/System.Console/src/System/ConsoleCancelEventArgs.cs
index 58ae18f7a1..86654d4068 100644
--- a/src/System.Console/src/System/ConsoleCancelEventArgs.cs
+++ b/src/System.Console/src/System/ConsoleCancelEventArgs.cs
@@ -7,6 +7,7 @@ namespace System
public delegate void ConsoleCancelEventHandler(Object sender, ConsoleCancelEventArgs e);
+ [Serializable]
public sealed class ConsoleCancelEventArgs : EventArgs
{
private readonly ConsoleSpecialKey _type;
diff --git a/src/System.Console/src/System/ConsoleColor.cs b/src/System.Console/src/System/ConsoleColor.cs
index 5e5dd6e99f..7f15ace8fb 100644
--- a/src/System.Console/src/System/ConsoleColor.cs
+++ b/src/System.Console/src/System/ConsoleColor.cs
@@ -7,6 +7,7 @@ namespace System
// This enumeration represents the colors that can be used for
// console text foreground and background colors.
+ [Serializable]
public enum ConsoleColor
{
Black = 0,
diff --git a/src/System.Console/src/System/ConsoleKey.cs b/src/System.Console/src/System/ConsoleKey.cs
index 28701c1a4c..1588232212 100644
--- a/src/System.Console/src/System/ConsoleKey.cs
+++ b/src/System.Console/src/System/ConsoleKey.cs
@@ -4,6 +4,7 @@
namespace System
{
+ [Serializable]
public enum ConsoleKey
{
Backspace = 0x8,
diff --git a/src/System.Console/src/System/ConsoleKeyInfo.cs b/src/System.Console/src/System/ConsoleKeyInfo.cs
index 4010eb45d0..76fdb718ff 100644
--- a/src/System.Console/src/System/ConsoleKeyInfo.cs
+++ b/src/System.Console/src/System/ConsoleKeyInfo.cs
@@ -4,6 +4,7 @@
namespace System
{
+ [Serializable]
public struct ConsoleKeyInfo
{
private readonly char _keyChar;
diff --git a/src/System.Console/src/System/ConsoleModifiers.cs b/src/System.Console/src/System/ConsoleModifiers.cs
index 6fb6449d24..8d9facd653 100644
--- a/src/System.Console/src/System/ConsoleModifiers.cs
+++ b/src/System.Console/src/System/ConsoleModifiers.cs
@@ -5,6 +5,7 @@
namespace System
{
[Flags]
+ [Serializable]
public enum ConsoleModifiers
{
Alt = 1,
diff --git a/src/System.Console/src/System/ConsoleSpecialKey.cs b/src/System.Console/src/System/ConsoleSpecialKey.cs
index df583ca7dd..d11b3c5b5e 100644
--- a/src/System.Console/src/System/ConsoleSpecialKey.cs
+++ b/src/System.Console/src/System/ConsoleSpecialKey.cs
@@ -4,6 +4,7 @@
namespace System
{
+ [Serializable]
public enum ConsoleSpecialKey
{
ControlC = 0,
diff --git a/src/System.Console/src/System/IO/SyncTextReader.cs b/src/System.Console/src/System/IO/SyncTextReader.cs
index f183a4f9da..20c8e70a31 100644
--- a/src/System.Console/src/System/IO/SyncTextReader.cs
+++ b/src/System.Console/src/System/IO/SyncTextReader.cs
@@ -12,6 +12,7 @@ namespace System.IO
/* SyncTextReader intentionally locks on itself rather than a private lock object.
* This is done to synchronize different console readers(Issue#2855).
*/
+ [Serializable]
internal sealed partial class SyncTextReader : TextReader
{
internal readonly TextReader _in;
diff --git a/src/System.Console/src/System/IO/SyncTextWriter.cs b/src/System.Console/src/System/IO/SyncTextWriter.cs
index af08df3493..f2c90724a8 100644
--- a/src/System.Console/src/System/IO/SyncTextWriter.cs
+++ b/src/System.Console/src/System/IO/SyncTextWriter.cs
@@ -13,6 +13,7 @@ namespace System.IO
* For example - colored console writers can be synchronized with non-colored
* writers by locking on Console.On (Issue#2855).
*/
+ [Serializable]
internal sealed class SyncTextWriter : TextWriter, IDisposable
{
internal readonly TextWriter _out;
diff --git a/src/System.Console/src/project.json b/src/System.Console/src/project.json
index 8ca4c657e7..d7ab210b71 100644
--- a/src/System.Console/src/project.json
+++ b/src/System.Console/src/project.json
@@ -32,7 +32,7 @@
"System.IO": "4.0.10",
"System.IO.FileSystem.Primitives": "4.0.0",
"System.Resources.ResourceManager": "4.0.0",
- "System.Runtime": "4.0.20",
+ "System.Runtime": "4.2.0-beta-devapi-24424-01",
"System.Runtime.Extensions": "4.0.10",
"System.Runtime.InteropServices": "4.0.20",
"System.Text.Encoding": "4.0.10",
diff --git a/src/System.IO.Compression/src/System.IO.Compression.csproj b/src/System.IO.Compression/src/System.IO.Compression.csproj
index 3205d62fdf..cd155835b2 100644
--- a/src/System.IO.Compression/src/System.IO.Compression.csproj
+++ b/src/System.IO.Compression/src/System.IO.Compression.csproj
@@ -60,6 +60,9 @@
<Link>Common\System\Threading\Tasks\TaskToApm.cs</Link>
</Compile>
</ItemGroup>
+ <ItemGroup Condition="'$(TargetGroup)' == '' ">
+ <Compile Include="System\IO\Compression\ZLibException.Serialization.cs" />
+ </ItemGroup>
<!-- Windows specific files common to both net46 and Core -->
<ItemGroup Condition=" '$(TargetsWindows)' == 'true'">
<Compile Include="System\IO\Compression\ZipArchiveEntry.Windows.cs" />
diff --git a/src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs b/src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs
new file mode 100644
index 0000000000..dcecb1fd8a
--- /dev/null
+++ b/src/System.IO.Compression/src/System/IO/Compression/ZLibException.Serialization.cs
@@ -0,0 +1,35 @@
+// 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.
+
+using System.Runtime.Serialization;
+using System.IO.Compression;
+
+namespace System.IO.Compression
+{
+ [Serializable]
+ internal partial class ZLibException : IOException, ISerializable
+ {
+ /// <summary>
+ /// Initializes a new ZLibException with serialized data.
+ /// </summary>
+ /// <param name="info">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>
+ /// <param name="context">The StreamingContext that contains contextual information about the source or destination.</param>
+ protected ZLibException(SerializationInfo info, StreamingContext context) :
+ base(info, context)
+ {
+ string errContext = info.GetString("zlibErrorContext");
+ ZLibNative.ErrorCode errCode = (ZLibNative.ErrorCode)info.GetInt32("zlibErrorCode");
+ string errMessage = info.GetString("zlibErrorMessage");
+ Init(errContext, errCode, errMessage);
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo si, StreamingContext context)
+ {
+ base.GetObjectData(si, context);
+ si.AddValue("zlibErrorContext", _zlibErrorContext);
+ si.AddValue("zlibErrorCode", (Int32)_zlibErrorCode);
+ si.AddValue("zlibErrorMessage", _zlibErrorMessage);
+ }
+ }
+}
diff --git a/src/System.IO.Compression/src/System/IO/Compression/ZLibException.cs b/src/System.IO.Compression/src/System/IO/Compression/ZLibException.cs
index 8bfbe2a607..a350efb4ba 100644
--- a/src/System.IO.Compression/src/System/IO/Compression/ZLibException.cs
+++ b/src/System.IO.Compression/src/System/IO/Compression/ZLibException.cs
@@ -11,7 +11,7 @@ namespace System.IO.Compression
/// <summary>
/// This is the exception that is thrown when a ZLib returns an error code indicating an unrecoverable error.
/// </summary>
- internal class ZLibException : IOException
+ internal partial class ZLibException : IOException
{
private string _zlibErrorContext = null;
private string _zlibErrorMessage = null;
@@ -88,15 +88,13 @@ namespace System.IO.Compression
public string ZLibContext
{
[SecurityCritical]
- get
- { return _zlibErrorContext; }
+ get { return _zlibErrorContext; }
}
public int ZLibErrorCode
{
[SecurityCritical]
- get
- { return (int)_zlibErrorCode; }
+ get { return (int)_zlibErrorCode; }
}
public string ZLibErrorMessage
diff --git a/src/System.IO.Compression/src/project.json b/src/System.IO.Compression/src/project.json
index 1fa39136a8..3c02e4b321 100644
--- a/src/System.IO.Compression/src/project.json
+++ b/src/System.IO.Compression/src/project.json
@@ -30,7 +30,7 @@
"System.Diagnostics.Tools": "4.0.0",
"System.IO": "4.2.0-beta-devapi-24424-01",
"System.Resources.ResourceManager": "4.0.0",
- "System.Runtime": "4.0.20",
+ "System.Runtime": "4.2.0-beta-devapi-24424-01",
"System.Runtime.Extensions": "4.0.10",
"System.Runtime.Handles": "4.0.0",
"System.Runtime.InteropServices": "4.0.20",
diff --git a/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.cs b/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.cs
index ba867132d2..39f4ae042e 100644
--- a/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.cs
+++ b/src/System.IO.IsolatedStorage/ref/System.IO.IsolatedStorage.cs
@@ -43,6 +43,7 @@ namespace System.IO.IsolatedStorage
public IsolatedStorageException() { }
public IsolatedStorageException(string message) { }
public IsolatedStorageException(string message, System.Exception inner) { }
+ protected IsolatedStorageException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}
public sealed partial class IsolatedStorageFile : System.IO.IsolatedStorage.IsolatedStorage, System.IDisposable
diff --git a/src/System.IO.IsolatedStorage/src/ApiCompatBaseline.uap101.txt b/src/System.IO.IsolatedStorage/src/ApiCompatBaseline.uap101.txt
new file mode 100644
index 0000000000..45a022d97e
--- /dev/null
+++ b/src/System.IO.IsolatedStorage/src/ApiCompatBaseline.uap101.txt
@@ -0,0 +1,3 @@
+Compat issues with assembly System.IO.IsolatedStorage:
+MembersMustExist : Member 'System.IO.IsolatedStorage.IsolatedStorageException..ctor(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)' does not exist in the implementation but it does exist in the contract.
+Total Issues: 1
diff --git a/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj b/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
index 20274902f2..8cb834ca87 100644
--- a/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
+++ b/src/System.IO.IsolatedStorage/src/System.IO.IsolatedStorage.csproj
@@ -36,6 +36,9 @@
<Compile Include="System\IO\IsolatedStorage\Helper.cs" />
<Compile Include="System\IO\IsolatedStorage\INormalizeForIsolatedStorage.cs" />
</ItemGroup>
+ <ItemGroup Condition="'$(TargetGroup)' == ''">
+ <Compile Include="System\IO\IsolatedStorage\IsolatedStorageException.Serialization.cs" />
+ </ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' != 'net463' and '$(EnableWinRT)' != 'true'">
<Compile Include="System\IO\IsolatedStorage\Helper.Win32.Unix.cs" />
</ItemGroup>
diff --git a/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs b/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs
new file mode 100644
index 0000000000..b19caff3bc
--- /dev/null
+++ b/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.Serialization.cs
@@ -0,0 +1,17 @@
+// 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.
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.IO.IsolatedStorage
+{
+ [Serializable]
+ public partial class IsolatedStorageException : Exception
+ {
+ protected IsolatedStorageException(SerializationInfo info, StreamingContext context) : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.cs b/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.cs
index 53613e1ea5..415f14eff5 100644
--- a/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.cs
+++ b/src/System.IO.IsolatedStorage/src/System/IO/IsolatedStorage/IsolatedStorageException.cs
@@ -6,7 +6,7 @@ using System;
namespace System.IO.IsolatedStorage
{
- public class IsolatedStorageException : Exception
+ public partial class IsolatedStorageException : Exception
{
private const int COR_E_ISOSTORE = unchecked((int)0x80131450);
diff --git a/src/System.Runtime.Serialization.Formatters/src/System/TemporaryStubs.cs b/src/System.Runtime.Serialization.Formatters/src/System/TemporaryStubs.cs
index 201274f709..3374d41e43 100644
--- a/src/System.Runtime.Serialization.Formatters/src/System/TemporaryStubs.cs
+++ b/src/System.Runtime.Serialization.Formatters/src/System/TemporaryStubs.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
@@ -6,6 +6,7 @@ using System.Reflection;
namespace System
{
+ [Serializable]
internal class MarshalByRefObject { } // TODO: Replace with real MarshalByRefObject when it's available
internal sealed class TypedReference // TODO: Replace with System.TypedReference when available and functional
diff --git a/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs b/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs
index c8417af3b6..e7d096fc7e 100644
--- a/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs
+++ b/src/System.Runtime.Serialization.Primitives/ref/System.Runtime.Serialization.Primitives.cs
@@ -72,11 +72,13 @@ namespace System.Runtime.Serialization
{
public IgnoreDataMemberAttribute() { }
}
+ [Serializable]
public partial class InvalidDataContractException : System.Exception
{
public InvalidDataContractException() { }
public InvalidDataContractException(string message) { }
public InvalidDataContractException(string message, System.Exception innerException) { }
+ protected InvalidDataContractException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
public partial interface ISerializationSurrogateProvider
{
diff --git a/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj b/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj
index 5590155a66..4c7bde0b7e 100644
--- a/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj
+++ b/src/System.Runtime.Serialization.Primitives/src/System.Runtime.Serialization.Primitives.csproj
@@ -35,12 +35,15 @@
<Compile Include="System\Runtime\Serialization\KnownTypeAttribute.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)'=='netstandard1.3' Or '$(TargetGroup)'=='netcore50aot'">
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnDeserializedAttribute.cs" />
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnDeserializingAttribute.cs" />
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnSerializedAttribute.cs" />
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnSerializingAttribute.cs" />
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\SerializationException.cs" />
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\StreamingContext.cs" />
+ <Compile Include="System\Runtime\Serialization\OnDeserializedAttribute.cs" />
+ <Compile Include="System\Runtime\Serialization\OnDeserializingAttribute.cs" />
+ <Compile Include="System\Runtime\Serialization\OnSerializedAttribute.cs" />
+ <Compile Include="System\Runtime\Serialization\OnSerializingAttribute.cs" />
+ <Compile Include="System\Runtime\Serialization\SerializationException.cs" />
+ <Compile Include="System\Runtime\Serialization\StreamingContext.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(TargetGroup)'==''">
+ <Compile Include="System\Runtime\Serialization\InvalidDataContractException.Serialization.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)'==''">
<!-- ToDo: Remove this dependency once System.Runtime is published. -->
diff --git a/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs
new file mode 100644
index 0000000000..be1e03a37d
--- /dev/null
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.Serialization.cs
@@ -0,0 +1,18 @@
+// 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.
+
+using System;
+
+namespace System.Runtime.Serialization
+{
+ [Serializable]
+ public partial class InvalidDataContractException : Exception
+ {
+ protected InvalidDataContractException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
+
diff --git a/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.cs
index 2d375ee406..afa8dfbf5b 100644
--- a/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/InvalidDataContractException.cs
@@ -2,13 +2,11 @@
// 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;
namespace System.Runtime.Serialization
{
- public class InvalidDataContractException : Exception
+ public partial class InvalidDataContractException : Exception
{
public InvalidDataContractException()
: base()
@@ -26,4 +24,3 @@ namespace System.Runtime.Serialization
}
}
}
-
diff --git a/src/Common/src/System/Runtime/Serialization/OnDeserializedAttribute.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnDeserializedAttribute.cs
index 408a55ccf9..408a55ccf9 100644
--- a/src/Common/src/System/Runtime/Serialization/OnDeserializedAttribute.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnDeserializedAttribute.cs
diff --git a/src/Common/src/System/Runtime/Serialization/OnDeserializingAttribute.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnDeserializingAttribute.cs
index 162857e8d3..162857e8d3 100644
--- a/src/Common/src/System/Runtime/Serialization/OnDeserializingAttribute.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnDeserializingAttribute.cs
diff --git a/src/Common/src/System/Runtime/Serialization/OnSerializedAttribute.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnSerializedAttribute.cs
index 020dd0257c..020dd0257c 100644
--- a/src/Common/src/System/Runtime/Serialization/OnSerializedAttribute.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnSerializedAttribute.cs
diff --git a/src/Common/src/System/Runtime/Serialization/OnSerializingAttribute.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnSerializingAttribute.cs
index 8dc8af3f23..8dc8af3f23 100644
--- a/src/Common/src/System/Runtime/Serialization/OnSerializingAttribute.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/OnSerializingAttribute.cs
diff --git a/src/Common/src/System/Runtime/Serialization/SerializationException.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/SerializationException.cs
index d03fac6793..d03fac6793 100644
--- a/src/Common/src/System/Runtime/Serialization/SerializationException.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/SerializationException.cs
diff --git a/src/Common/src/System/Runtime/Serialization/StreamingContext.cs b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/StreamingContext.cs
index 98a622fc68..98a622fc68 100644
--- a/src/Common/src/System/Runtime/Serialization/StreamingContext.cs
+++ b/src/System.Runtime.Serialization.Primitives/src/System/Runtime/Serialization/StreamingContext.cs
diff --git a/src/System.Runtime.Serialization.Primitives/src/project.json b/src/System.Runtime.Serialization.Primitives/src/project.json
index 922b6aabb4..db0ce3a191 100644
--- a/src/System.Runtime.Serialization.Primitives/src/project.json
+++ b/src/System.Runtime.Serialization.Primitives/src/project.json
@@ -12,7 +12,7 @@
},
"netstandard1.7": {
"dependencies": {
- "System.Runtime": "4.0.20",
+ "System.Runtime": "4.2.0-beta-devapi-24424-01",
"System.Resources.ResourceManager": "4.0.0",
"System.Threading.Tasks": "4.0.10"
},
diff --git a/src/System.Runtime/src/System.Runtime.csproj b/src/System.Runtime/src/System.Runtime.csproj
index 5849d617b8..b6cea84ca4 100644
--- a/src/System.Runtime/src/System.Runtime.csproj
+++ b/src/System.Runtime/src/System.Runtime.csproj
@@ -38,55 +38,6 @@
<ItemGroup Condition="'$(TargetGroup)'!='netcore50aot' And ('$(TargetGroup)'!='net462' AND '$(TargetGroup)'!='net463')">
<Compile Include="System\ComponentModel\DefaultValueAttribute.cs" />
</ItemGroup>
- <!-- TODO: Uncomment/fix all of this when we actually build this lib for netcore50aot
- <ItemGroup Condition="'$(TargetGroup)'=='netcore50aot'">
- <Compile Include="$(CommonPath)\System\NonSerializedAttribute.cs">
- <Link>System\NonSerializedAttribute.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\SerializableAttribute.cs">
- <Link>System\SerializableAttribute.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\IDeserializationCallback.cs">
- <Link>System\Runtime\Serialization\IDeserializationCallback.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\IFormatterConverter.cs">
- <Link>System\Runtime\Serialization\IFormatterConverter.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\IObjectReference.cs">
- <Link>System\Runtime\Serialization\IObjectReference.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\ISerializable.cs">
- <Link>System\Runtime\Serialization\ISerializable.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnDeserializedAttribute.cs">
- <Link>System\Runtime\Serialization\OnDeserializedAttribute.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnDeserializingAttribute.cs">
- <Link>System\Runtime\Serialization\OnDeserializingAttribute.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnSerializedAttribute.cs">
- <Link>System\Runtime\Serialization\OnSerializedAttribute.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OnSerializingAttribute.cs">
- <Link>System\Runtime\Serialization\OnSerializingAttribute.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\OptionalFieldAttribute.cs">
- <Link>System\Runtime\Serialization\OptionalFieldAttribute.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\SerializationException.cs">
- <Link>System\Runtime\Serialization\SerializationException.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\SerializationInfo.cs">
- <Link>System\Runtime\Serialization\SerializationInfo.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\SerializationInfoEnumerator.cs">
- <Link>System\Runtime\Serialization\SerializationInfoEnumerator.cs</Link>
- </Compile>
- <Compile Include="$(CommonPath)\System\Runtime\Serialization\StreamingContext.cs">
- <Link>System\Runtime\Serialization\StreamingContext.cs</Link>
- </Compile>
- </ItemGroup>
- -->
<ItemGroup Condition="'$(TargetGroup)' != 'net462' And '$(TargetGroup)' != 'net463'">
<ProjectReference Include="..\..\System.Private.Uri\src\System.Private.Uri.csproj">
<OSGroup>Windows_NT</OSGroup>
diff --git a/src/System.Runtime/src/System/LazyOfTTMetadata.cs b/src/System.Runtime/src/System/LazyOfTTMetadata.cs
index 07bb02c1ff..2af4cd5fec 100644
--- a/src/System.Runtime/src/System/LazyOfTTMetadata.cs
+++ b/src/System.Runtime/src/System/LazyOfTTMetadata.cs
@@ -8,6 +8,7 @@ using System.Threading;
namespace System
{
+ [Serializable]
public class Lazy<T, TMetadata> : Lazy<T>
{
private readonly TMetadata _metadata;
diff --git a/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj b/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
index af5248adae..cb8c6480ea 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
+++ b/src/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
@@ -364,6 +364,14 @@
<Link>Common\System\Security\Cryptography\RSAOpenSsl.cs</Link>
</Compile>
</ItemGroup>
+ <ItemGroup Condition="'$(TargetGroup)' != '' And '$(IsPartialFacadeAssembly)' != 'true'">
+ <Compile Include="$(CommonPath)\System\SerializableAttribute.cs">
+ <Link>Common\System\SerializableAttribute.cs</Link>
+ </Compile>
+ <Compile Include="$(CommonPath)\System\NonSerializedAttribute.cs">
+ <Link>Common\System\NonSerializedAttribute.cs</Link>
+ </Compile>
+ </ItemGroup>
<ItemGroup Condition="'$(IsPartialFacadeAssembly)'=='true'">
<TargetingPackReference Include="mscorlib" />
<TargetingPackReference Include="System" />
diff --git a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs
index 71825d2a57..5bc00b52d6 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs
+++ b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSAParameters.cs
@@ -4,6 +4,10 @@
namespace System.Security.Cryptography
{
+ // DSAParameters is serializable so that one could pass the public parameters
+ // across a remote call, but we explicitly make the private key X non-serializable
+ // so you cannot accidently send it along with the public parameters.
+ [Serializable]
public struct DSAParameters
{
public byte[] P;
@@ -11,7 +15,7 @@ namespace System.Security.Cryptography
public byte[] G;
public byte[] Y;
public byte[] J;
- public byte[] X;
+ [NonSerialized] public byte[] X;
public byte[] Seed;
public int Counter;
}
diff --git a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs
index 9a728debee..bffb39701e 100644
--- a/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs
+++ b/src/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSAParameters.cs
@@ -8,16 +8,18 @@ using System.Security.Cryptography;
namespace System.Security.Cryptography
{
+ // We allow only the public components of an RSAParameters object, the Modulus and Exponent to be serializable.
+ [Serializable]
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public struct RSAParameters
{
- public byte[] D;
- public byte[] DP;
- public byte[] DQ;
+ [NonSerialized] public byte[] D;
+ [NonSerialized] public byte[] DP;
+ [NonSerialized] public byte[] DQ;
public byte[] Exponent;
- public byte[] InverseQ;
+ [NonSerialized] public byte[] InverseQ;
public byte[] Modulus;
- public byte[] P;
- public byte[] Q;
+ [NonSerialized] public byte[] P;
+ [NonSerialized] public byte[] Q;
}
}
diff --git a/src/System.Security.Cryptography.Algorithms/src/project.json b/src/System.Security.Cryptography.Algorithms/src/project.json
index ffcd90bbdd..387b394add 100644
--- a/src/System.Security.Cryptography.Algorithms/src/project.json
+++ b/src/System.Security.Cryptography.Algorithms/src/project.json
@@ -8,7 +8,7 @@
"System.Diagnostics.Tools": "4.0.0",
"System.IO": "4.0.10",
"System.Resources.ResourceManager": "4.0.0",
- "System.Runtime": "4.0.20",
+ "System.Runtime": "4.2.0-beta-devapi-24424-01",
"System.Runtime.Extensions": "4.0.0",
"System.Runtime.InteropServices": "4.0.20",
"System.Runtime.Numerics": "4.0.0",
diff --git a/src/System.Transactions/src/System/Transactions/DistributedTransaction.cs b/src/System.Transactions/src/System/Transactions/DistributedTransaction.cs
index 8cdbf4f150..ae066a770c 100644
--- a/src/System.Transactions/src/System/Transactions/DistributedTransaction.cs
+++ b/src/System.Transactions/src/System/Transactions/DistributedTransaction.cs
@@ -58,8 +58,22 @@ namespace System.Transactions.Distributed
/// the transaction.
/// </summary>
[Serializable]
- internal class DistributedTransaction : ISerializable //, IObjectReference
+ internal class DistributedTransaction : ISerializable, IObjectReference
{
+ internal DistributedTransaction()
+ {
+ }
+
+ protected DistributedTransaction(SerializationInfo serializationInfo, StreamingContext context)
+ {
+ if (serializationInfo == null)
+ {
+ throw new ArgumentNullException(nameof(serializationInfo));
+ }
+
+ throw NotSupported();
+ }
+
internal Exception InnerException { get; set; }
internal Guid Identifier { get; set; }
internal RealDistributedTransaction RealTransaction { get; set; }
@@ -101,6 +115,11 @@ namespace System.Transactions.Distributed
throw NotSupported();
}
+ public object GetRealObject(StreamingContext context)
+ {
+ throw NotSupported();
+ }
+
internal byte[] GetTransmitterPropagationToken()
{
throw NotSupported();
@@ -111,8 +130,13 @@ namespace System.Transactions.Distributed
throw NotSupported();
}
- void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ void ISerializable.GetObjectData(SerializationInfo serializationInfo, StreamingContext context)
{
+ if (serializationInfo == null)
+ {
+ throw new ArgumentNullException(nameof(serializationInfo));
+ }
+
throw NotSupported();
}