Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@@ -68,7 +68,10 @@ namespace System
internal IEnumerator<T> InternalArray__IEnumerable_GetEnumerator<T> ()
{
return new InternalEnumerator<T> (this);
if (Length == 0)
return EmptyInternalEnumerator<T>.Value;
else
return new InternalEnumerator<T> (this);
}
internal void InternalArray__ICollection_Clear ()
@@ -207,7 +210,7 @@ namespace System
// we just decr the size, so, 0 - 1 == FINISHED
const int FINISHED = -1;
Array array;
readonly Array array;
int idx;
internal InternalEnumerator (Array array)
@@ -218,7 +221,6 @@ namespace System
public void Dispose ()
{
idx = NOT_STARTED;
}
public bool MoveNext ()
@@ -272,6 +274,38 @@ namespace System
}
}
internal class EmptyInternalEnumerator<T> : IEnumerator<T>
{
public static readonly EmptyInternalEnumerator<T> Value = new EmptyInternalEnumerator<T> ();
public void Dispose ()
{
return;
}
public bool MoveNext ()
{
return false;
}
public T Current {
get {
throw new InvalidOperationException ("Enumeration has not started. Call MoveNext");
}
}
object IEnumerator.Current {
get {
return Current;
}
}
void IEnumerator.Reset ()
{
return;
}
}
// InternalCall Methods
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern int GetRank ();
@@ -320,7 +354,7 @@ namespace System
"Index has to be between upper and lower bound of the array."));
if (GetType ().GetElementType ().IsPointer)
throw new NotSupportedException ("Type is not supported");
throw new NotSupportedException ("Type is not supported.");
return GetValueImpl (index - lb);
}
@@ -348,7 +382,7 @@ namespace System
"Index has to be >= lower bound and <= upper bound of the array."));
if (GetType ().GetElementType ().IsPointer)
throw new NotSupportedException ("Type is not supported");
throw new NotSupportedException ("Type is not supported.");
SetValueImpl (value, index - lb);
}
@@ -701,7 +735,7 @@ namespace System
get {
if (_index < 0) throw new InvalidOperationException (SR.InvalidOperation_EnumNotStarted);
if (_index >= _endIndex) throw new InvalidOperationException (SR.InvalidOperation_EnumEnded);
if (_index == 0 && _array.GetType ().GetElementType ().IsPointer) throw new NotSupportedException ("Type is not supported");
if (_index == 0 && _array.GetType ().GetElementType ().IsPointer) throw new NotSupportedException ("Type is not supported.");
return _array.GetValueImpl(_index);
}
}

View File

@@ -97,7 +97,7 @@ namespace System.IO {
public override string ReadToEnd ()
{
try {
return (base.ReadToEnd ());
return driver.ReadToEnd ();
} catch (IOException) {
}

View File

@@ -214,7 +214,7 @@ namespace System {
//
static OperatingSystem os;
static extern PlatformID Platform {
static internal PlatformID Platform {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
get;
}

View File

@@ -1102,6 +1102,16 @@ namespace System {
}
public string ReadLine ()
{
return ReadUntilConditionInternal (true);
}
public string ReadToEnd ()
{
return ReadUntilConditionInternal (false);
}
private string ReadUntilConditionInternal (bool haltOnNewLine)
{
if (!inited)
Init ();
@@ -1120,6 +1130,8 @@ namespace System {
rl_starty = cursorTop;
char eof = (char) control_characters [ControlCharacters.EOF];
bool treatAsEnterKey;
do {
key = ReadKeyInternal (out fresh);
echo = echo || fresh;
@@ -1128,7 +1140,9 @@ namespace System {
if (c == eof && c != 0 && builder.Length == 0)
return null;
if (key.Key != ConsoleKey.Enter) {
treatAsEnterKey = haltOnNewLine && (key.Key == ConsoleKey.Enter);
if (!treatAsEnterKey) {
if (key.Key != ConsoleKey.Backspace) {
builder.Append (c);
} else if (builder.Length > 0) {
@@ -1142,7 +1156,7 @@ namespace System {
// echo fresh keys back to the console
if (echo)
Echo (key);
} while (key.Key != ConsoleKey.Enter);
} while (!treatAsEnterKey);
EchoFlush ();

View File

@@ -242,7 +242,7 @@ namespace System
//
try {
if (GetDynamicTimeZoneInformationEffectiveYears (ref timeZoneInformation, out firstYear, out lastYear) == 0) {
if (GetDynamicTimeZoneInformationEffectiveYears (ref timeZoneInformation, out firstYear, out lastYear) != 0) {
firstYear = lastYear = 0;
}
} catch {

View File

@@ -209,9 +209,12 @@ namespace System
#if WIN_PLATFORM
if (TimeZoneKey != null) {
foreach (string id in TimeZoneKey.GetSubKeyNames ()) {
try {
systemTimeZones.Add (FindSystemTimeZoneById (id));
} catch {}
using (RegistryKey subkey = TimeZoneKey.OpenSubKey (id))
{
if (subkey == null || subkey.GetValue ("TZI") == null)
continue;
}
systemTimeZones.Add (FindSystemTimeZoneById (id));
}
return;
@@ -657,15 +660,13 @@ namespace System
DateTime start_timeofday = new DateTime (1, 1, 1, daylight_hour, daylight_minute, daylight_second, daylight_millisecond);
TransitionTime start_transition_time;
start_date = new DateTime (start_year, 1, 1);
if (daylight_year == 0) {
start_date = new DateTime (start_year, 1, 1);
start_transition_time = TransitionTime.CreateFloatingDateRule (
start_timeofday, daylight_month, daylight_day,
(DayOfWeek) daylight_dayofweek);
}
else {
start_date = new DateTime (daylight_year, daylight_month, daylight_day,
daylight_hour, daylight_minute, daylight_second, daylight_millisecond);
start_transition_time = TransitionTime.CreateFixedDateRule (
start_timeofday, daylight_month, daylight_day);
}
@@ -674,15 +675,13 @@ namespace System
DateTime end_timeofday = new DateTime (1, 1, 1, standard_hour, standard_minute, standard_second, standard_millisecond);
TransitionTime end_transition_time;
end_date = new DateTime (end_year, 12, 31);
if (standard_year == 0) {
end_date = new DateTime (end_year, 12, 31);
end_transition_time = TransitionTime.CreateFloatingDateRule (
end_timeofday, standard_month, standard_day,
(DayOfWeek) standard_dayofweek);
}
else {
end_date = new DateTime (standard_year, standard_month, standard_day,
standard_hour, standard_minute, standard_second, standard_millisecond);
end_transition_time = TransitionTime.CreateFixedDateRule (
end_timeofday, standard_month, standard_day);
}

View File

@@ -0,0 +1,12 @@
using System;
#if MOBILE
namespace System {
[AttributeUsage(AttributeTargets.Field)]
public sealed class WeakAttribute : Attribute
{
}
}
#endif