From a2d4a328c5e6f297ddf93643b8d565cd2c56574c Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Wed, 10 Jan 2018 16:16:47 -0800 Subject: [PATCH 1/5] Refresh System.Runtime ref from System.Private.CoreLib in Coreclr This also includes an update to the genapi tool that includes the necessary private fields in structs to enable the compiler to do correctness checks. See https://github.com/dotnet/corefx/issues/6185. --- .../ref/System.Runtime.Manual.cs | 2 +- src/System.Runtime/ref/System.Runtime.cs | 128 ++++++++++++++---- src/System.Runtime/ref/System.Runtime.csproj | 2 +- 3 files changed, 100 insertions(+), 32 deletions(-) diff --git a/src/System.Runtime/ref/System.Runtime.Manual.cs b/src/System.Runtime/ref/System.Runtime.Manual.cs index 2003d97e1dee..b5f4565170df 100644 --- a/src/System.Runtime/ref/System.Runtime.Manual.cs +++ b/src/System.Runtime/ref/System.Runtime.Manual.cs @@ -44,6 +44,6 @@ namespace System.Reflection // In the meantime, these will be exposed via wrapper factory methods in System.Private.Reflection.Extensibility. public partial struct CustomAttributeNamedArgument { - internal CustomAttributeNamedArgument(Type attributeType, string memberName, bool isField, CustomAttributeTypedArgument typedValue) { } + internal CustomAttributeNamedArgument(Type attributeType, string memberName, bool isField, CustomAttributeTypedArgument typedValue) { throw null; } } } diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index e79d9e839fb2..632d53e36718 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -108,7 +108,7 @@ protected ApplicationException(System.Runtime.Serialization.SerializationInfo in public ApplicationException(string message) { } public ApplicationException(string message, System.Exception innerException) { } } - public partial class ArgumentException : System.SystemException, System.Runtime.Serialization.ISerializable + public partial class ArgumentException : System.SystemException { public ArgumentException() { } protected ArgumentException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -128,7 +128,7 @@ public ArgumentNullException(string paramName) { } public ArgumentNullException(string message, System.Exception innerException) { } public ArgumentNullException(string paramName, string message) { } } - public partial class ArgumentOutOfRangeException : System.ArgumentException, System.Runtime.Serialization.ISerializable + public partial class ArgumentOutOfRangeException : System.ArgumentException { public ArgumentOutOfRangeException() { } protected ArgumentOutOfRangeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -268,6 +268,7 @@ void System.Collections.IList.RemoveAt(int index) { } } public readonly partial struct ArraySegment : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable { + private readonly T[] _array; public ArraySegment(T[] array) { throw null; } public ArraySegment(T[] array, int offset, int count) { throw null; } public T[] Array { get { throw null; } } @@ -293,7 +294,6 @@ public void CopyTo(T[] destination, int destinationIndex) { } void System.Collections.Generic.ICollection.Add(T item) { } void System.Collections.Generic.ICollection.Clear() { } bool System.Collections.Generic.ICollection.Contains(T item) { throw null; } - void System.Collections.Generic.ICollection.CopyTo(T[] array, int arrayIndex) { } bool System.Collections.Generic.ICollection.Remove(T item) { throw null; } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } int System.Collections.Generic.IList.IndexOf(T item) { throw null; } @@ -303,6 +303,7 @@ void System.Collections.Generic.IList.RemoveAt(int index) { } public T[] ToArray() { throw null; } public partial struct Enumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable { + private readonly T[] _array; public T Current { get { throw null; } } object System.Collections.IEnumerator.Current { get { throw null; } } public void Dispose() { } @@ -404,6 +405,7 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf } public partial struct Boolean : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable { + private object _dummy; public static readonly string FalseString; public static readonly string TrueString; public int CompareTo(System.Boolean value) { throw null; } @@ -448,6 +450,7 @@ public static void SetByte(System.Array array, int index, byte value) { } } public partial struct Byte : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const byte MaxValue = (byte)255; public const byte MinValue = (byte)0; public int CompareTo(System.Byte value) { throw null; } @@ -456,7 +459,7 @@ public partial struct Byte : System.IComparable, System.IComparable, Syste public override bool Equals(object obj) { throw null; } public override int GetHashCode() { throw null; } public System.TypeCode GetTypeCode() { throw null; } - public static System.Byte Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } + public static System.Byte Parse(System.ReadOnlySpan s, System.Globalization.NumberStyles style=(System.Globalization.NumberStyles)(7), System.IFormatProvider provider=null) { throw null; } public static System.Byte Parse(string s) { throw null; } public static System.Byte Parse(string s, System.Globalization.NumberStyles style) { throw null; } public static System.Byte Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; } @@ -488,6 +491,7 @@ public partial struct Byte : System.IComparable, System.IComparable, Syste } public partial struct Char : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable { + private object _dummy; public const char MaxValue = '\uFFFF'; public const char MinValue = '\0'; public int CompareTo(System.Char value) { throw null; } @@ -580,6 +584,7 @@ public CLSCompliantAttribute(bool isCompliant) { } public delegate TOutput Converter(TInput input); public readonly partial struct DateTime : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.Runtime.Serialization.ISerializable { + private readonly int _dummy; public static readonly System.DateTime MaxValue; public static readonly System.DateTime MinValue; public static readonly System.DateTime UnixEpoch; @@ -659,8 +664,6 @@ public CLSCompliantAttribute(bool isCompliant) { } public static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeKind kind) { throw null; } public System.TimeSpan Subtract(System.DateTime value) { throw null; } public System.DateTime Subtract(System.TimeSpan value) { throw null; } - int System.IComparable.CompareTo(object value) { throw null; } - System.TypeCode System.IConvertible.GetTypeCode() { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; } @@ -709,6 +712,7 @@ public enum DateTimeKind } public partial struct DateTimeOffset : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable { + private object _dummy; public static readonly System.DateTimeOffset MaxValue; public static readonly System.DateTimeOffset MinValue; public static readonly System.DateTimeOffset UnixEpoch; @@ -836,6 +840,7 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S } public partial struct Decimal : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable, System.Runtime.Serialization.IDeserializationCallback { + private int _dummy; [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)4294967295, (uint)4294967295, (uint)4294967295)] public static readonly decimal MaxValue; [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)0, (uint)0, (uint)1)] @@ -1012,6 +1017,7 @@ public DivideByZeroException(string message, System.Exception innerException) { } public partial struct Double : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; //public const double Epsilon = 4.94065645841247E-324; -- defined in System.Runtime.Manual.cs //public const double MaxValue = 1.7976931348623157E+308; -- defined in System.Runtime.Manual.cs //public const double MinValue = -1.7976931348623157E+308; -- defined in System.Runtime.Manual.cs @@ -1068,7 +1074,7 @@ public partial struct Double : System.IComparable, System.IComparable, S public static bool TryParse(string s, out System.Double result) { throw null; } public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Double result) { throw null; } } - public partial class DuplicateWaitObjectException : System.ArgumentException, System.Runtime.Serialization.ISerializable + public partial class DuplicateWaitObjectException : System.ArgumentException { public DuplicateWaitObjectException() { } protected DuplicateWaitObjectException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -1101,7 +1107,6 @@ protected Enum() { } public static object Parse(System.Type enumType, string value, bool ignoreCase) { throw null; } public static TEnum Parse(string value) where TEnum : struct { throw null; } public static TEnum Parse(string value, bool ignoreCase) where TEnum : struct { throw null; } - System.TypeCode System.IConvertible.GetTypeCode() { throw null; } bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; } byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; } char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; } @@ -1302,6 +1307,7 @@ public GopherStyleUriParser() { } } public partial struct Guid : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable { + private int _dummy; public static readonly System.Guid Empty; public Guid(byte[] b) { throw null; } public Guid(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { throw null; } @@ -1335,6 +1341,7 @@ public partial struct Guid : System.IComparable, System.IComparable } public partial struct HashCode { + private int _dummy; public void Add(T value) { } public void Add(T value, System.Collections.Generic.IEqualityComparer comparer) { } public static int Combine(T1 value1) { throw null; } @@ -1437,6 +1444,7 @@ public InsufficientMemoryException(string message, System.Exception innerExcepti } public partial struct Int16 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const short MaxValue = (short)32767; public const short MinValue = (short)-32768; public int CompareTo(System.Int16 value) { throw null; } @@ -1477,6 +1485,7 @@ public partial struct Int16 : System.IComparable, System.IComparable, Sys } public partial struct Int32 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const int MaxValue = 2147483647; public const int MinValue = -2147483648; public System.Int32 CompareTo(System.Int32 value) { throw null; } @@ -1517,6 +1526,7 @@ public partial struct Int32 : System.IComparable, System.IComparable, Syste } public partial struct Int64 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const long MaxValue = (long)9223372036854775807; public const long MinValue = (long)-9223372036854775808; public int CompareTo(System.Int64 value) { throw null; } @@ -1557,6 +1567,7 @@ public partial struct Int64 : System.IComparable, System.IComparable, Syst } public partial struct IntPtr : System.IEquatable, System.Runtime.Serialization.ISerializable { + private object _dummy; public static readonly System.IntPtr Zero; public IntPtr(int value) { throw null; } public IntPtr(long value) { throw null; } @@ -1579,7 +1590,7 @@ public partial struct IntPtr : System.IEquatable, System.Runtime. public static bool operator !=(System.IntPtr value1, System.IntPtr value2) { throw null; } public static System.IntPtr operator -(System.IntPtr pointer, int offset) { throw null; } public static System.IntPtr Subtract(System.IntPtr pointer, int offset) { throw null; } - bool System.IEquatable.Equals(System.IntPtr other) { throw null; } + bool System.IEquatable.Equals(System.IntPtr value) { throw null; } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public int ToInt32() { throw null; } public long ToInt64() { throw null; } @@ -1673,6 +1684,7 @@ public MemberAccessException(string message, System.Exception inner) { } } public readonly partial struct Memory { + private readonly object _dummy; public Memory(T[] array) { throw null; } public Memory(T[] array, int start, int length) { throw null; } public static System.Memory Empty { get { throw null; } } @@ -1729,7 +1741,7 @@ public MissingMemberException(string className, string memberName) { } public override string Message { get { throw null; } } public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } } - public partial class MissingMethodException : System.MissingMemberException, System.Runtime.Serialization.ISerializable + public partial class MissingMethodException : System.MissingMemberException { public MissingMethodException() { } protected MissingMethodException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -1740,6 +1752,7 @@ public MissingMethodException(string className, string methodName) { } } public partial struct ModuleHandle { + private object _dummy; public static readonly System.ModuleHandle EmptyHandle; public int MDStreamVersion { get { throw null; } } public bool Equals(System.ModuleHandle handle) { throw null; } @@ -1833,6 +1846,7 @@ public static partial class Nullable } public partial struct Nullable where T : struct { + internal T value; public Nullable(T value) { throw null; } public bool HasValue { get { throw null; } } public T Value { get { throw null; } } @@ -1918,6 +1932,7 @@ public RankException(string message, System.Exception innerException) { } } public readonly partial struct ReadOnlyMemory { + private readonly object _dummy; public ReadOnlyMemory(T[] array) { throw null; } public ReadOnlyMemory(T[] array, int start, int length) { throw null; } public static System.ReadOnlyMemory Empty { get { throw null; } } @@ -1940,6 +1955,7 @@ public void CopyTo(System.Memory destination) { } } public readonly ref partial struct ReadOnlySpan { + private readonly object _dummy; [System.CLSCompliantAttribute(false)] public unsafe ReadOnlySpan(void* pointer, int length) { throw null; } public ReadOnlySpan(T[] array) { throw null; } @@ -1952,11 +1968,11 @@ public void CopyTo(System.Span destination) { } [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static System.ReadOnlySpan DangerousCreate(object obj, ref T objectData, int length) { throw null; } [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("Equals() on ReadOnlySpan will always throw an exception. Use == instead.")] + [System.ObsoleteAttribute("Equals() on Span will always throw an exception. Use == instead.")] public override bool Equals(object obj) { throw null; } public System.ReadOnlySpan.Enumerator GetEnumerator() { throw null; } [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("GetHashCode() on ReadOnlySpan will always throw an exception.")] + [System.ObsoleteAttribute("GetHashCode() on Span will always throw an exception.")] public override int GetHashCode() { throw null; } public static bool operator ==(System.ReadOnlySpan left, System.ReadOnlySpan right) { throw null; } public static implicit operator System.ReadOnlySpan (System.ArraySegment arraySegment) { throw null; } @@ -1968,6 +1984,7 @@ public void CopyTo(System.Span destination) { } public bool TryCopyTo(System.Span destination) { throw null; } public ref partial struct Enumerator { + private object _dummy; public ref readonly T Current { get { throw null; } } public bool MoveNext() { throw null; } } @@ -1981,9 +1998,11 @@ public ResolveEventArgs(string name, System.Reflection.Assembly requestingAssemb } public partial struct RuntimeArgumentHandle { + private object _dummy; } public partial struct RuntimeFieldHandle : System.Runtime.Serialization.ISerializable { + private object _dummy; public System.IntPtr Value { get { throw null; } } public override bool Equals(object obj) { throw null; } public bool Equals(System.RuntimeFieldHandle handle) { throw null; } @@ -1994,6 +2013,7 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S } public partial struct RuntimeMethodHandle : System.Runtime.Serialization.ISerializable { + private object _dummy; public System.IntPtr Value { get { throw null; } } public override bool Equals(object obj) { throw null; } public bool Equals(System.RuntimeMethodHandle handle) { throw null; } @@ -2005,10 +2025,12 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S } public partial struct RuntimeTypeHandle : System.Runtime.Serialization.ISerializable { + private object _dummy; public System.IntPtr Value { get { throw null; } } public override bool Equals(object obj) { throw null; } public bool Equals(System.RuntimeTypeHandle handle) { throw null; } public override int GetHashCode() { throw null; } + [System.CLSCompliantAttribute(false)] public System.ModuleHandle GetModuleHandle() { throw null; } public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public static bool operator ==(object left, System.RuntimeTypeHandle right) { throw null; } @@ -2019,6 +2041,7 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S [System.CLSCompliantAttribute(false)] public partial struct SByte : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const sbyte MaxValue = (sbyte)127; public const sbyte MinValue = (sbyte)-128; public int CompareTo(object obj) { throw null; } @@ -2073,6 +2096,7 @@ public SerializableAttribute() { } } public partial struct Single : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; //public const float Epsilon = 1.401298E-45f; -- defined in System.Runtime.Manual.cs //public const float MaxValue = 3.40282347E+38f; -- defined in System.Runtime.Manual.cs //public const float MinValue = -3.40282347E+38f; -- defined in System.Runtime.Manual.cs @@ -2131,6 +2155,7 @@ public partial struct Single : System.IComparable, System.IComparable, Sy } public readonly ref partial struct Span { + private readonly object _dummy; [System.CLSCompliantAttribute(false)] public unsafe Span(void* pointer, int length) { throw null; } public Span(T[] array) { throw null; } @@ -2162,6 +2187,7 @@ public void Fill(T value) { } public bool TryCopyTo(System.Span destination) { throw null; } public ref partial struct Enumerator { + private object _dummy; public ref T Current { get { throw null; } } public bool MoveNext() { throw null; } } @@ -2220,7 +2246,6 @@ public unsafe String(sbyte* value, int startIndex, int length, System.Text.Encod public static System.String Concat(System.String str0, System.String str1) { throw null; } public static System.String Concat(System.String str0, System.String str1, System.String str2) { throw null; } public static System.String Concat(System.String str0, System.String str1, System.String str2, System.String str3) { throw null; } - [System.CLSCompliantAttribute(false)] public static System.String Concat(params string[] values) { throw null; } public static System.String Concat(System.Collections.Generic.IEnumerable values) { throw null; } public bool Contains(char value) { throw null; } @@ -2396,6 +2421,7 @@ public TimeoutException(string message, System.Exception innerException) { } } public partial struct TimeSpan : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable { + private int _dummy; public static readonly System.TimeSpan MaxValue; public static readonly System.TimeSpan MinValue; public const long TicksPerDay = (long)864000000000; @@ -2465,7 +2491,7 @@ public partial struct TimeSpan : System.IComparable, System.IComparable destination, out int charsWritten, System.ReadOnlySpan format=default(System.ReadOnlySpan), System.IFormatProvider provider=null) { throw null; } + public bool TryFormat(System.Span destination, out int charsWritten, System.ReadOnlySpan format=default(System.ReadOnlySpan), System.IFormatProvider formatProvider=null) { throw null; } public static bool TryParse(System.ReadOnlySpan input, System.IFormatProvider formatProvider, out System.TimeSpan result) { throw null; } public static bool TryParse(System.ReadOnlySpan s, out System.TimeSpan result) { throw null; } public static bool TryParse(string input, System.IFormatProvider formatProvider, out System.TimeSpan result) { throw null; } @@ -2554,6 +2580,7 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser } public readonly partial struct TransitionTime : System.IEquatable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable { + private readonly object _dummy; public int Day { get { throw null; } } public System.DayOfWeek DayOfWeek { get { throw null; } } public bool IsFixedDateRule { get { throw null; } } @@ -2591,26 +2618,47 @@ public static partial class Tuple } public static partial class TupleExtensions { + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple value, out T1 item1) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple value, out T1 item1, out T2 item2) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple>> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9, out T10 item10, out T11 item11, out T12 item12, out T13 item13, out T14 item14, out T15 item15, out T16 item16, out T17 item17, out T18 item18, out T19 item19, out T20 item20, out T21 item21) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple value, out T1 item1, out T2 item2, out T3 item3) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple value, out T1 item1, out T2 item2, out T3 item3, out T4 item4) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static void Deconstruct(this System.Tuple> value, out T1 item1, out T2 item2, out T3 item3, out T4 item4, out T5 item5, out T6 item6, out T7 item7, out T8 item8, out T9 item9) { throw null; } public static System.Tuple ToTuple(this System.ValueTuple value) { throw null; } public static System.Tuple> ToTuple(this System.ValueTuple> value) { throw null; } @@ -3018,6 +3066,7 @@ public enum TypeCode [System.CLSCompliantAttribute(false)] public partial struct TypedReference { + private object _dummy; public override bool Equals(object o) { throw null; } public override int GetHashCode() { throw null; } public static System.Type GetTargetType(System.TypedReference value) { throw null; } @@ -3044,7 +3093,7 @@ public TypeLoadException(string message, System.Exception inner) { } public string TypeName { get { throw null; } } public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } } - public partial class TypeUnloadedException : System.SystemException, System.Runtime.Serialization.ISerializable + public partial class TypeUnloadedException : System.SystemException { public TypeUnloadedException() { } protected TypeUnloadedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -3054,6 +3103,7 @@ public TypeUnloadedException(string message, System.Exception innerException) { [System.CLSCompliantAttribute(false)] public partial struct UInt16 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const ushort MaxValue = (ushort)65535; public const ushort MinValue = (ushort)0; public int CompareTo(object value) { throw null; } @@ -3104,6 +3154,7 @@ public partial struct UInt16 : System.IComparable, System.IComparable, S [System.CLSCompliantAttribute(false)] public partial struct UInt32 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const uint MaxValue = (uint)4294967295; public const uint MinValue = (uint)0; public int CompareTo(object value) { throw null; } @@ -3154,6 +3205,7 @@ public partial struct UInt32 : System.IComparable, System.IComparable, Sys [System.CLSCompliantAttribute(false)] public partial struct UInt64 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { + private int _dummy; public const ulong MaxValue = (ulong)18446744073709551615; public const ulong MinValue = (ulong)0; public int CompareTo(object value) { throw null; } @@ -3204,10 +3256,10 @@ public partial struct UInt64 : System.IComparable, System.IComparable, Sy [System.CLSCompliantAttribute(false)] public partial struct UIntPtr : System.IEquatable, System.Runtime.Serialization.ISerializable { + private object _dummy; public static readonly System.UIntPtr Zero; public UIntPtr(uint value) { throw null; } public UIntPtr(ulong value) { throw null; } - [System.CLSCompliantAttribute(false)] public unsafe UIntPtr(void* value) { throw null; } public static int Size { get { throw null; } } public static System.UIntPtr Add(System.UIntPtr pointer, int offset) { throw null; } @@ -3219,16 +3271,13 @@ public partial struct UIntPtr : System.IEquatable, System.Runtim public static explicit operator System.UIntPtr (ulong value) { throw null; } public static explicit operator uint (System.UIntPtr value) { throw null; } public static explicit operator ulong (System.UIntPtr value) { throw null; } - [System.CLSCompliantAttribute(false)] public unsafe static explicit operator void* (System.UIntPtr value) { throw null; } - [System.CLSCompliantAttribute(false)] public unsafe static explicit operator System.UIntPtr (void* value) { throw null; } public static bool operator !=(System.UIntPtr value1, System.UIntPtr value2) { throw null; } public static System.UIntPtr operator -(System.UIntPtr pointer, int offset) { throw null; } public static System.UIntPtr Subtract(System.UIntPtr pointer, int offset) { throw null; } - bool System.IEquatable.Equals(System.UIntPtr other) { throw null; } + bool System.IEquatable.Equals(System.UIntPtr value) { throw null; } void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - [System.CLSCompliantAttribute(false)] public unsafe void* ToPointer() { throw null; } public override string ToString() { throw null; } public uint ToUInt32() { throw null; } @@ -3662,6 +3711,7 @@ public partial interface IRetainable } public partial struct MemoryHandle : System.IDisposable { + private object _dummy; [System.CLSCompliantAttribute(false)] public unsafe MemoryHandle(System.Buffers.IRetainable owner, void* pointer=null, System.Runtime.InteropServices.GCHandle handle=default(System.Runtime.InteropServices.GCHandle)) { throw null; } public bool HasPointer { get { throw null; } } @@ -3691,6 +3741,7 @@ namespace System.Collections { public partial struct DictionaryEntry { + private object _dummy; public DictionaryEntry(object key, object value) { throw null; } public object Key { get { throw null; } set { } } public object Value { get { throw null; } set { } } @@ -3841,7 +3892,7 @@ public partial interface ISet : System.Collections.Generic.ICollection, Sy void SymmetricExceptWith(System.Collections.Generic.IEnumerable other); void UnionWith(System.Collections.Generic.IEnumerable other); } - public partial class KeyNotFoundException : System.SystemException, System.Runtime.Serialization.ISerializable + public partial class KeyNotFoundException : System.SystemException { public KeyNotFoundException() { } protected KeyNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -3854,6 +3905,8 @@ public static partial class KeyValuePair } public readonly partial struct KeyValuePair { + private readonly TKey key; + private readonly TValue value; public KeyValuePair(TKey key, TValue value) { throw null; } public TKey Key { get { throw null; } } public TValue Value { get { throw null; } } @@ -4222,7 +4275,7 @@ public void ClearCachedData() { } public static System.Globalization.CultureInfo ReadOnly(System.Globalization.CultureInfo ci) { throw null; } public override string ToString() { throw null; } } - public partial class CultureNotFoundException : System.ArgumentException, System.Runtime.Serialization.ISerializable + public partial class CultureNotFoundException : System.ArgumentException { public CultureNotFoundException() { } protected CultureNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } @@ -4991,11 +5044,11 @@ public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess acc public virtual System.IntPtr Handle { get { throw null; } } public virtual bool IsAsync { get { throw null; } } public override long Length { get { throw null; } } - public string Name { get { throw null; } } + public virtual string Name { get { throw null; } } public override long Position { get { throw null; } set { } } public virtual Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle { get { throw null; } } - public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; } - public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; } + public override System.IAsyncResult BeginRead(byte[] array, int offset, int numBytes, System.AsyncCallback callback, object state) { throw null; } + public override System.IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, System.AsyncCallback callback, object state) { throw null; } protected override void Dispose(bool disposing) { } public override int EndRead(System.IAsyncResult asyncResult) { throw null; } public override void EndWrite(System.IAsyncResult asyncResult) { } @@ -5464,6 +5517,7 @@ public CustomAttributeFormatException(string message, System.Exception inner) { } public partial struct CustomAttributeNamedArgument { + private object _dummy; public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, object value) { throw null; } public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, System.Reflection.CustomAttributeTypedArgument typedArgument) { throw null; } public bool IsField { get { throw null; } } @@ -5478,6 +5532,7 @@ public partial struct CustomAttributeNamedArgument } public partial struct CustomAttributeTypedArgument { + private object _dummy; public CustomAttributeTypedArgument(object value) { throw null; } public CustomAttributeTypedArgument(System.Type argumentType, object value) { throw null; } public System.Type ArgumentType { get { throw null; } } @@ -5962,6 +6017,7 @@ protected ParameterInfo() { } } public readonly partial struct ParameterModifier { + private readonly object _dummy; public ParameterModifier(int parameterCount) { throw null; } public bool this[int index] { get { throw null; } set { } } } @@ -6256,7 +6312,7 @@ public MemoryFailPoint(int sizeInMegabytes) { } public void Dispose() { } ~MemoryFailPoint() { } } - [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false, Inherited=false)] + [System.AttributeUsageAttribute((System.AttributeTargets)(96), AllowMultiple=false, Inherited=false)] public sealed partial class TargetedPatchingOptOutAttribute : System.Attribute { public TargetedPatchingOptOutAttribute(string reason) { } @@ -6284,6 +6340,7 @@ public AsyncStateMachineAttribute(System.Type stateMachineType) : base (default( } public partial struct AsyncValueTaskMethodBuilder { + private TResult _result; public System.Threading.Tasks.ValueTask Task { get { throw null; } } public void AwaitOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { } public void AwaitUnsafeOnCompleted(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { } @@ -6347,9 +6404,11 @@ public void Clear() { } } public readonly partial struct ConfiguredTaskAwaitable { + private readonly object _dummy; public System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter GetAwaiter() { throw null; } public readonly partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion { + private readonly object _dummy; public bool IsCompleted { get { throw null; } } public void GetResult() { } public void OnCompleted(System.Action continuation) { } @@ -6358,9 +6417,11 @@ public void UnsafeOnCompleted(System.Action continuation) { } } public readonly partial struct ConfiguredTaskAwaitable { + private readonly object _dummy; public System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter GetAwaiter() { throw null; } public readonly partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion { + private readonly object _dummy; public bool IsCompleted { get { throw null; } } public TResult GetResult() { throw null; } public void OnCompleted(System.Action continuation) { } @@ -6369,9 +6430,11 @@ public void UnsafeOnCompleted(System.Action continuation) { } } public readonly partial struct ConfiguredValueTaskAwaitable { + private readonly object _dummy; public System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter GetAwaiter() { throw null; } public partial struct ConfiguredValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion { + private object _dummy; public bool IsCompleted { get { throw null; } } public TResult GetResult() { throw null; } public void OnCompleted(System.Action continuation) { } @@ -6612,6 +6675,7 @@ public SuppressIldasmAttribute() { } } public readonly partial struct TaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion { + private readonly object _dummy; public bool IsCompleted { get { throw null; } } public void GetResult() { } public void OnCompleted(System.Action continuation) { } @@ -6619,6 +6683,7 @@ public void UnsafeOnCompleted(System.Action continuation) { } } public readonly partial struct TaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion { + private readonly object _dummy; public bool IsCompleted { get { throw null; } } public TResult GetResult() { throw null; } public void OnCompleted(System.Action continuation) { } @@ -6650,6 +6715,7 @@ public UnsafeValueTypeAttribute() { } } public partial struct ValueTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion { + private object _dummy; public bool IsCompleted { get { throw null; } } public TResult GetResult() { throw null; } public void OnCompleted(System.Action continuation) { } @@ -6769,6 +6835,7 @@ public FieldOffsetAttribute(int offset) { } } public partial struct GCHandle { + private object _dummy; public bool IsAllocated { get { throw null; } } public object Target { get { throw null; } set { } } public System.IntPtr AddrOfPinnedObject() { throw null; } @@ -6855,15 +6922,11 @@ public partial interface IFormatterConverter short ToInt16(object value); int ToInt32(object value); long ToInt64(object value); - [System.CLSCompliantAttribute(false)] sbyte ToSByte(object value); float ToSingle(object value); string ToString(object value); - [System.CLSCompliantAttribute(false)] ushort ToUInt16(object value); - [System.CLSCompliantAttribute(false)] uint ToUInt32(object value); - [System.CLSCompliantAttribute(false)] ulong ToUInt64(object value); } public partial interface IObjectReference @@ -6912,6 +6975,7 @@ public void AddSerializedState(System.Runtime.Serialization.ISafeSerializationDa } public partial struct SerializationEntry { + private object _dummy; public string Name { get { throw null; } } public System.Type ObjectType { get { throw null; } } public object Value { get { throw null; } } @@ -6991,6 +7055,7 @@ public void Reset() { } } public readonly partial struct StreamingContext { + private readonly object _dummy; public StreamingContext(System.Runtime.Serialization.StreamingContextStates state) { throw null; } public StreamingContext(System.Runtime.Serialization.StreamingContextStates state, object additional) { throw null; } public object Context { get { throw null; } } @@ -7498,6 +7563,7 @@ namespace System.Threading { public readonly partial struct CancellationToken { + private readonly object _dummy; public CancellationToken(bool canceled) { throw null; } public bool CanBeCanceled { get { throw null; } } public bool IsCancellationRequested { get { throw null; } } @@ -7516,6 +7582,7 @@ public void ThrowIfCancellationRequested() { } } public readonly partial struct CancellationTokenRegistration : System.IDisposable, System.IEquatable { + private readonly object _dummy; public System.Threading.CancellationToken Token { get { throw null; } } public void Dispose() { } public override bool Equals(object obj) { throw null; } @@ -7897,6 +7964,7 @@ public void SetObserved() { } [System.Runtime.CompilerServices.AsyncMethodBuilderAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<>))] public readonly partial struct ValueTask : System.IEquatable> { + internal readonly TResult _result; public ValueTask(System.Threading.Tasks.Task task) { throw null; } public ValueTask(TResult result) { throw null; } public bool IsCanceled { get { throw null; } } diff --git a/src/System.Runtime/ref/System.Runtime.csproj b/src/System.Runtime/ref/System.Runtime.csproj index 3bf3278f934d..1b18098a25a9 100644 --- a/src/System.Runtime/ref/System.Runtime.csproj +++ b/src/System.Runtime/ref/System.Runtime.csproj @@ -6,7 +6,7 @@ true {ADBCF120-3454-4A3C-9D1D-AC4293E795D6} - $(NoWarn);0809;0618 + $(NoWarn);0809;0618;0169 $(DefineConstants);FEATURE_DEFAULT_INTERFACES From 9288c499b2491a2208225b8621ac99f7a301081e Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Thu, 11 Jan 2018 10:10:49 -0800 Subject: [PATCH 2/5] Update struct private field types to not count unsafe pointers as object --- src/System.Runtime/ref/System.Runtime.cs | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index 632d53e36718..fb894ded11e9 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -405,7 +405,7 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf } public partial struct Boolean : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable { - private object _dummy; + private int _dummy; public static readonly string FalseString; public static readonly string TrueString; public int CompareTo(System.Boolean value) { throw null; } @@ -491,7 +491,7 @@ public partial struct Byte : System.IComparable, System.IComparable, Syste } public partial struct Char : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable { - private object _dummy; + private int _dummy; public const char MaxValue = '\uFFFF'; public const char MinValue = '\0'; public int CompareTo(System.Char value) { throw null; } @@ -712,7 +712,7 @@ public enum DateTimeKind } public partial struct DateTimeOffset : System.IComparable, System.IComparable, System.IEquatable, System.IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable { - private object _dummy; + private int _dummy; public static readonly System.DateTimeOffset MaxValue; public static readonly System.DateTimeOffset MinValue; public static readonly System.DateTimeOffset UnixEpoch; @@ -1567,7 +1567,7 @@ public partial struct Int64 : System.IComparable, System.IComparable, Syst } public partial struct IntPtr : System.IEquatable, System.Runtime.Serialization.ISerializable { - private object _dummy; + private int _dummy; public static readonly System.IntPtr Zero; public IntPtr(int value) { throw null; } public IntPtr(long value) { throw null; } @@ -1955,7 +1955,7 @@ public void CopyTo(System.Memory destination) { } } public readonly ref partial struct ReadOnlySpan { - private readonly object _dummy; + private readonly int _dummy; [System.CLSCompliantAttribute(false)] public unsafe ReadOnlySpan(void* pointer, int length) { throw null; } public ReadOnlySpan(T[] array) { throw null; } @@ -1984,7 +1984,7 @@ public void CopyTo(System.Span destination) { } public bool TryCopyTo(System.Span destination) { throw null; } public ref partial struct Enumerator { - private object _dummy; + private int _dummy; public ref readonly T Current { get { throw null; } } public bool MoveNext() { throw null; } } @@ -1998,7 +1998,7 @@ public ResolveEventArgs(string name, System.Reflection.Assembly requestingAssemb } public partial struct RuntimeArgumentHandle { - private object _dummy; + private int _dummy; } public partial struct RuntimeFieldHandle : System.Runtime.Serialization.ISerializable { @@ -2155,7 +2155,7 @@ public partial struct Single : System.IComparable, System.IComparable, Sy } public readonly ref partial struct Span { - private readonly object _dummy; + private readonly int _dummy; [System.CLSCompliantAttribute(false)] public unsafe Span(void* pointer, int length) { throw null; } public Span(T[] array) { throw null; } @@ -2187,7 +2187,7 @@ public void Fill(T value) { } public bool TryCopyTo(System.Span destination) { throw null; } public ref partial struct Enumerator { - private object _dummy; + private int _dummy; public ref T Current { get { throw null; } } public bool MoveNext() { throw null; } } @@ -2580,7 +2580,7 @@ void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Ser } public readonly partial struct TransitionTime : System.IEquatable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable { - private readonly object _dummy; + private readonly int _dummy; public int Day { get { throw null; } } public System.DayOfWeek DayOfWeek { get { throw null; } } public bool IsFixedDateRule { get { throw null; } } @@ -3066,7 +3066,7 @@ public enum TypeCode [System.CLSCompliantAttribute(false)] public partial struct TypedReference { - private object _dummy; + private int _dummy; public override bool Equals(object o) { throw null; } public override int GetHashCode() { throw null; } public static System.Type GetTargetType(System.TypedReference value) { throw null; } @@ -3256,7 +3256,7 @@ public partial struct UInt64 : System.IComparable, System.IComparable, Sy [System.CLSCompliantAttribute(false)] public partial struct UIntPtr : System.IEquatable, System.Runtime.Serialization.ISerializable { - private object _dummy; + private int _dummy; public static readonly System.UIntPtr Zero; public UIntPtr(uint value) { throw null; } public UIntPtr(ulong value) { throw null; } @@ -6835,7 +6835,7 @@ public FieldOffsetAttribute(int offset) { } } public partial struct GCHandle { - private object _dummy; + private int _dummy; public bool IsAllocated { get { throw null; } } public object Target { get { throw null; } set { } } public System.IntPtr AddrOfPinnedObject() { throw null; } From c58e40fa36b7292e87fddc4606e88198f7a70d1e Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Thu, 11 Jan 2018 10:16:55 -0800 Subject: [PATCH 3/5] Fix ReadOnlySpan obsolete message to reference ReadOnlySpan instead of Span Remove unnecessary CLSCompliant(false) on GetModuleHandle --- src/System.Runtime/ref/System.Runtime.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index fb894ded11e9..286691de2beb 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -1968,11 +1968,11 @@ public void CopyTo(System.Span destination) { } [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] public static System.ReadOnlySpan DangerousCreate(object obj, ref T objectData, int length) { throw null; } [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("Equals() on Span will always throw an exception. Use == instead.")] + [System.ObsoleteAttribute("Equals() on ReadOnlySpan will always throw an exception. Use == instead.")] public override bool Equals(object obj) { throw null; } public System.ReadOnlySpan.Enumerator GetEnumerator() { throw null; } [System.ComponentModel.EditorBrowsableAttribute((System.ComponentModel.EditorBrowsableState)(1))] - [System.ObsoleteAttribute("GetHashCode() on Span will always throw an exception.")] + [System.ObsoleteAttribute("GetHashCode() on ReadOnlySpan will always throw an exception.")] public override int GetHashCode() { throw null; } public static bool operator ==(System.ReadOnlySpan left, System.ReadOnlySpan right) { throw null; } public static implicit operator System.ReadOnlySpan (System.ArraySegment arraySegment) { throw null; } @@ -2030,7 +2030,6 @@ public partial struct RuntimeTypeHandle : System.Runtime.Serialization.ISerializ public override bool Equals(object obj) { throw null; } public bool Equals(System.RuntimeTypeHandle handle) { throw null; } public override int GetHashCode() { throw null; } - [System.CLSCompliantAttribute(false)] public System.ModuleHandle GetModuleHandle() { throw null; } public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } public static bool operator ==(object left, System.RuntimeTypeHandle right) { throw null; } From 7e3912919409251928b73c4f9db51db797fb47b8 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Thu, 11 Jan 2018 12:55:40 -0800 Subject: [PATCH 4/5] Update System.Runtime ref primitive types to contain field of same type --- src/System.Runtime/ref/System.Runtime.cs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index 286691de2beb..7dba5c1c29fa 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -405,7 +405,7 @@ public override void GetObjectData(System.Runtime.Serialization.SerializationInf } public partial struct Boolean : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable { - private int _dummy; + private bool _dummy; public static readonly string FalseString; public static readonly string TrueString; public int CompareTo(System.Boolean value) { throw null; } @@ -450,7 +450,7 @@ public static void SetByte(System.Array array, int index, byte value) { } } public partial struct Byte : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private byte _dummy; public const byte MaxValue = (byte)255; public const byte MinValue = (byte)0; public int CompareTo(System.Byte value) { throw null; } @@ -491,7 +491,7 @@ public partial struct Byte : System.IComparable, System.IComparable, Syste } public partial struct Char : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable { - private int _dummy; + private char _dummy; public const char MaxValue = '\uFFFF'; public const char MinValue = '\0'; public int CompareTo(System.Char value) { throw null; } @@ -1017,7 +1017,7 @@ public DivideByZeroException(string message, System.Exception innerException) { } public partial struct Double : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private double _dummy; //public const double Epsilon = 4.94065645841247E-324; -- defined in System.Runtime.Manual.cs //public const double MaxValue = 1.7976931348623157E+308; -- defined in System.Runtime.Manual.cs //public const double MinValue = -1.7976931348623157E+308; -- defined in System.Runtime.Manual.cs @@ -1444,7 +1444,7 @@ public InsufficientMemoryException(string message, System.Exception innerExcepti } public partial struct Int16 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private short _dummy; public const short MaxValue = (short)32767; public const short MinValue = (short)-32768; public int CompareTo(System.Int16 value) { throw null; } @@ -1526,7 +1526,7 @@ public partial struct Int32 : System.IComparable, System.IComparable, Syste } public partial struct Int64 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private long _dummy; public const long MaxValue = (long)9223372036854775807; public const long MinValue = (long)-9223372036854775808; public int CompareTo(System.Int64 value) { throw null; } @@ -2040,7 +2040,7 @@ public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, S [System.CLSCompliantAttribute(false)] public partial struct SByte : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private sbyte _dummy; public const sbyte MaxValue = (sbyte)127; public const sbyte MinValue = (sbyte)-128; public int CompareTo(object obj) { throw null; } @@ -2095,7 +2095,7 @@ public SerializableAttribute() { } } public partial struct Single : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private float _dummy; //public const float Epsilon = 1.401298E-45f; -- defined in System.Runtime.Manual.cs //public const float MaxValue = 3.40282347E+38f; -- defined in System.Runtime.Manual.cs //public const float MinValue = -3.40282347E+38f; -- defined in System.Runtime.Manual.cs @@ -3102,7 +3102,7 @@ public TypeUnloadedException(string message, System.Exception innerException) { [System.CLSCompliantAttribute(false)] public partial struct UInt16 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private ushort _dummy; public const ushort MaxValue = (ushort)65535; public const ushort MinValue = (ushort)0; public int CompareTo(object value) { throw null; } @@ -3153,7 +3153,7 @@ public partial struct UInt16 : System.IComparable, System.IComparable, S [System.CLSCompliantAttribute(false)] public partial struct UInt32 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private uint _dummy; public const uint MaxValue = (uint)4294967295; public const uint MinValue = (uint)0; public int CompareTo(object value) { throw null; } @@ -3204,7 +3204,7 @@ public partial struct UInt32 : System.IComparable, System.IComparable, Sys [System.CLSCompliantAttribute(false)] public partial struct UInt64 : System.IComparable, System.IComparable, System.IConvertible, System.IEquatable, System.IFormattable { - private int _dummy; + private ulong _dummy; public const ulong MaxValue = (ulong)18446744073709551615; public const ulong MinValue = (ulong)0; public int CompareTo(object value) { throw null; } From 6ef954562c71fe7f3de4db7407d3d4ec58825dd7 Mon Sep 17 00:00:00 2001 From: Wes Haggard Date: Thu, 11 Jan 2018 12:56:54 -0800 Subject: [PATCH 5/5] Teach the tool to understand ByReference contains a reference This make Span and ReadOnlySpan have a reference and thus generates a private object field for the compiler to do the correct checks. --- src/System.Runtime/ref/System.Runtime.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/System.Runtime/ref/System.Runtime.cs b/src/System.Runtime/ref/System.Runtime.cs index 7dba5c1c29fa..a1682f993c44 100644 --- a/src/System.Runtime/ref/System.Runtime.cs +++ b/src/System.Runtime/ref/System.Runtime.cs @@ -1955,7 +1955,7 @@ public void CopyTo(System.Memory destination) { } } public readonly ref partial struct ReadOnlySpan { - private readonly int _dummy; + private readonly object _dummy; [System.CLSCompliantAttribute(false)] public unsafe ReadOnlySpan(void* pointer, int length) { throw null; } public ReadOnlySpan(T[] array) { throw null; } @@ -1984,7 +1984,7 @@ public void CopyTo(System.Span destination) { } public bool TryCopyTo(System.Span destination) { throw null; } public ref partial struct Enumerator { - private int _dummy; + private object _dummy; public ref readonly T Current { get { throw null; } } public bool MoveNext() { throw null; } } @@ -2154,7 +2154,7 @@ public partial struct Single : System.IComparable, System.IComparable, Sy } public readonly ref partial struct Span { - private readonly int _dummy; + private readonly object _dummy; [System.CLSCompliantAttribute(false)] public unsafe Span(void* pointer, int length) { throw null; } public Span(T[] array) { throw null; } @@ -2186,7 +2186,7 @@ public void Fill(T value) { } public bool TryCopyTo(System.Span destination) { throw null; } public ref partial struct Enumerator { - private int _dummy; + private object _dummy; public ref T Current { get { throw null; } } public bool MoveNext() { throw null; } }