Imported Upstream version 4.2.1.36

Former-commit-id: fb75898888a02f4d3a74cf0a5b841681bc4c7fa8
This commit is contained in:
Xamarin Public Jenkins
2015-09-24 06:06:07 -04:00
committed by Jo Shields
parent 9668de7cb8
commit dd547c45d4
172 changed files with 6570 additions and 11015 deletions

View File

@ -908,10 +908,6 @@ public class Tests : TestsBase, ITest2
public void invoke2 () {
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public void invoke3 () {
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public void invoke_ex () {
invoke_ex_inner ();

View File

@ -1 +1 @@
3c62a78ee4f20b1751753ce79842028dd874ffad
0b47f1fbeb2c75de4f83067cd1412c5298cd8c63

View File

@ -442,8 +442,10 @@ namespace System.Net.NetworkInformation {
unsafe void OnDataAvailable (object sender, SocketAsyncEventArgs args)
{
if (nl_sock == null) // Recent changes in Mono cause MaybeCloseSocket to be called before OnDataAvailable
return;
EventType type;
fixed (byte *ptr = args.Buffer) {
fixed (byte *ptr = args.Buffer) {
type = ReadEvents (nl_sock.Handle, new IntPtr (ptr), args.BytesTransferred, 8192);
}
nl_sock.ReceiveAsync (nl_args);

View File

@ -96,6 +96,12 @@ namespace System {
set { s_IriParsing = value; }
}
// Do not rename this.
// User code might set this to true with reflection.
// When set to true an Uri constructed with UriKind.RelativeOrAbsolute
// and paths such as "/foo" is assumed relative.
private static bool useDotNetRelativeOrAbsolute;
#if BOOTSTRAP_BASIC
private static readonly string hexUpperChars = "0123456789ABCDEF";
private static readonly string [] Empty = new string [0];
@ -147,6 +153,8 @@ namespace System {
IriParsing = true;
else if (iriparsingVar == "false")
IriParsing = false;
useDotNetRelativeOrAbsolute = Environment.GetEnvironmentVariable ("MONO_URI_DOTNETRELATIVEORABSOLUTE") == "true";
}
public Uri (string uriString) : this (uriString, false)
@ -173,12 +181,21 @@ namespace System {
// When used instead of UriKind.RelativeOrAbsolute paths such as "/foo" are assumed relative.
const UriKind DotNetRelativeOrAbsolute = (UriKind) 300;
private void ProcessUriKind (string uriString, ref UriKind uriKind)
{
if (uriString == null)
return;
if (uriKind == DotNetRelativeOrAbsolute ||
(uriKind == UriKind.RelativeOrAbsolute && useDotNetRelativeOrAbsolute))
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
}
public Uri (string uriString, UriKind uriKind)
{
source = uriString;
if (uriString != null && uriKind == DotNetRelativeOrAbsolute)
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
ProcessUriKind (uriString, ref uriKind);
ParseUri (uriKind);
@ -212,8 +229,7 @@ namespace System {
return;
}
if (uriKind == DotNetRelativeOrAbsolute)
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
ProcessUriKind (uriString, ref uriKind);
if (uriKind != UriKind.RelativeOrAbsolute &&
uriKind != UriKind.Absolute &&

View File

@ -263,7 +263,12 @@ namespace System
builder.Append (scheme);
// note: mailto and news use ':', not "://", as their delimiter
builder.Append (Uri.GetSchemeDelimiter (scheme));
if (UriParser.IsKnownScheme(scheme)) {
builder.Append (Uri.GetSchemeDelimiter (scheme));
}
else {
builder.Append (host.Length > 0 ? Uri.SchemeDelimiter : ":");
}
if (username != String.Empty) {
builder.Append (username);
@ -280,7 +285,8 @@ namespace System
if (path != String.Empty &&
builder [builder.Length - 1] != '/' &&
path.Length > 0 && path [0] != '/')
path.Length > 0 && path [0] != '/' &&
host.Length > 0)
builder.Append ('/');
builder.Append (path);
builder.Append (query);

View File

@ -387,6 +387,13 @@ namespace MonoTests.System
// this is what ASP.NET really means (the ?)
Assert.AreEqual ("http://192.168.0.21/error404.aspx?aspxerrorpath=/WebResource.axd", ub.Uri.ToString ());
}
[Test]
public void NoHostname ()
{
UriBuilder ub = new UriBuilder ("about", null, -1, "config");
Assert.AreEqual ("about:config", ub.ToString ());
}
}
}

View File

@ -1946,12 +1946,44 @@ namespace MonoTests.System
[Test]
public void DotNetRelativeOrAbsoluteTest ()
{
var uri1 = new Uri ("/foo", DotNetRelativeOrAbsolute);
Assert.IsFalse (uri1.IsAbsoluteUri);
Uri uri2;
Uri.TryCreate("/foo", DotNetRelativeOrAbsolute, out uri2);
Assert.IsFalse (uri2.IsAbsoluteUri);
FieldInfo useDotNetRelativeOrAbsoluteField = null;
bool useDotNetRelativeOrAbsoluteOld = false;
if (Type.GetType ("Mono.Runtime") != null) {
useDotNetRelativeOrAbsoluteField = typeof (Uri).GetField ("useDotNetRelativeOrAbsolute",
BindingFlags.Static | BindingFlags.GetField | BindingFlags.NonPublic);
useDotNetRelativeOrAbsoluteOld = (bool) useDotNetRelativeOrAbsoluteField.GetValue (null);
useDotNetRelativeOrAbsoluteField.SetValue (null, false);
}
try {
Uri uri;
uri = new Uri ("/foo", DotNetRelativeOrAbsolute);
Assert.IsFalse (uri.IsAbsoluteUri);
Uri.TryCreate("/foo", DotNetRelativeOrAbsolute, out uri);
Assert.IsFalse (uri.IsAbsoluteUri);
if (useDotNetRelativeOrAbsoluteField != null) {
uri = new Uri ("/foo", UriKind.RelativeOrAbsolute);
Assert.IsTrue (uri.IsAbsoluteUri);
Uri.TryCreate("/foo", UriKind.RelativeOrAbsolute, out uri);
Assert.IsTrue (uri.IsAbsoluteUri);
useDotNetRelativeOrAbsoluteField.SetValue (null, true);
}
uri = new Uri ("/foo", UriKind.RelativeOrAbsolute);
Assert.IsFalse (uri.IsAbsoluteUri);
Uri.TryCreate("/foo", DotNetRelativeOrAbsolute, out uri);
Assert.IsFalse (uri.IsAbsoluteUri);
} finally {
if (useDotNetRelativeOrAbsoluteField != null)
useDotNetRelativeOrAbsoluteField.SetValue (null, useDotNetRelativeOrAbsoluteOld);
}
}
[Test]

View File

@ -816,8 +816,15 @@ namespace System.Globalization
CultureInfo ci = new CultureInfo ();
if (!ci.construct_internal_locale_from_name (name)) {
int idx = name.IndexOf ('-');
if (idx < 1 || !ci.construct_internal_locale_from_name (name.Substring (0, idx)))
int idx = name.Length - 1;
if (idx > 0) {
while ((idx = name.LastIndexOf ('-', idx - 1)) > 0) {
if (ci.construct_internal_locale_from_name (name.Substring (0, idx)))
break;
}
}
if (idx <= 0)
throw CreateNotFoundException (src_name);
}

View File

@ -870,12 +870,12 @@ namespace System
}
// DaylightTime.Start is relative to the Standard time.
if (start != DateTime.MinValue)
start += BaseUtcOffset;
if (!TryAddTicks (start, BaseUtcOffset.Ticks, out start))
start = DateTime.MinValue;
// DaylightTime.End is relative to the DST time.
if (end != DateTime.MinValue)
end += BaseUtcOffset + delta;
if (!TryAddTicks (end, BaseUtcOffset.Ticks + delta.Ticks, out end))
end = DateTime.MinValue;
} else {
AdjustmentRule first = null, last = null;

View File

@ -171,6 +171,21 @@ namespace MonoTests.System.Globalization
ci = CultureInfo.CreateSpecificCulture ("");
Assert.AreEqual (CultureInfo.InvariantCulture, ci, "#5");
ci = CultureInfo.CreateSpecificCulture ("zh-hant");
Assert.AreEqual ("zh-HK", ci.Name, "#6");
ci = CultureInfo.CreateSpecificCulture ("zh-hans");
Assert.AreEqual ("zh-CN", ci.Name, "#7");
ci = CultureInfo.CreateSpecificCulture ("zh-hans-CN");
Assert.AreEqual ("zh-CN", ci.Name, "#8");
ci = CultureInfo.CreateSpecificCulture ("zh-hant-US");
Assert.AreEqual ("zh-HK", ci.Name, "#9");
ci = CultureInfo.CreateSpecificCulture ("az-CyrlM-BR");
Assert.AreEqual ("az-Latn-AZ", ci.Name, "#10");
}
[Test]

View File

@ -232,6 +232,7 @@ namespace MonoTests.System
[Test]
[ExpectedException (typeof (ArgumentOutOfRangeException))]
[Category("MobileNotWorking")]
public void AddHoursOutOfRangeException1 ()
{
DateTime t1 = new DateTime (myTicks [1]);
@ -240,6 +241,7 @@ namespace MonoTests.System
[Test]
[ExpectedException (typeof (ArgumentOutOfRangeException))]
[Category("MobileNotWorking")]
public void AddHoursOutOfRangeException2 ()
{
DateTime t1 = new DateTime (myTicks [1]);

View File

@ -1062,6 +1062,19 @@ namespace MonoTests.System
Assert.AreEqual (new DateTime (2014, 10, 5, 2, 0, 0), changes.Start);
Assert.AreEqual (new DateTime (2014, 4, 6, 3, 0, 0), changes.End);
}
[Test]
public void AllTimeZonesDaylightChanges ()
{
foreach (var tz in TimeZoneInfo.GetSystemTimeZones ()) {
try {
for (var year = 1950; year <= DateTime.Now.Year; year++)
getChanges.Invoke (tz, new object [] {year} );
} catch (Exception e) {
Assert.Fail ("TimeZone " + tz.Id + " exception: " + e.ToString ());
}
}
}
}
}
}

View File

@ -1 +1 @@
80ad68773619189fd92720dfc4be4dc88e96837d
0240ebb4d2659b40f56c66a63819f414a5d9df62

View File

@ -1 +1 @@
efd0208862719ddb6274c0cdbcbe08a24b61babd
ce9eb809ba177cb9c5f9387d1e2d93f17a583be9

View File

@ -1 +1 @@
5ad7fbc34106e98a365ad644947cefe6d5f1f9aa
dda3cb77811a304fcb8a8c77455268e06b7080b9

View File

@ -1 +1 @@
f5f71ca9569838c64b51c3e99c6fe845872a457c
d5cb6b4dd17539ae3babb95e036964746d5bb92e

View File

@ -1 +1 @@
c1b008b9b65aea06d591cf25fb0b8e290e1e8103
cb7dc0666856e54db03e68c589fc978dd269c5f3

View File

@ -1 +1 @@
efb429e450136e909b0edfdffcf39c51066a5d82
b341b2406947158e34dcfde3e0e842d2f8f45366

View File

@ -1 +1 @@
23172d2e452014cf90875324e9178ca360a9b996
e69df203c4e52e18dafc6255ea6247008eecfadb

View File

@ -1 +1 @@
8b05839479cc274cab0914bae666e7d6d62f6c09
cfddc735dcaad9c8ee6f62802c7b870328e6d9e7