Imported Upstream version 4.0.2.4

Former-commit-id: de0c2bbc3d900ab3bd764cd6c9d9062472ce7456
This commit is contained in:
Xamarin Public Jenkins
2015-06-10 19:29:21 -04:00
parent 98e85815fb
commit cae8e1b2db
46 changed files with 249 additions and 134 deletions

View File

@@ -256,9 +256,8 @@ namespace Microsoft.Build.Tasks {
{
PackageAssemblyInfo pkg = null;
if (specific_version) {
pkg = PcCache.GetAssemblyLocation (reference.ItemSpec);
} else {
pkg = PcCache.GetAssemblyLocation (reference.ItemSpec);
if (pkg == null && !specific_version) {
// if not specific version, then just match simple name
string name = reference.ItemSpec;
if (name.IndexOf (',') > 0)

View File

@@ -26,6 +26,8 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml;
@@ -334,34 +336,29 @@ namespace System.Xml.Linq
static readonly char [] escapeChars = new char [] {'<', '>', '&', '"', '\r', '\n', '\t'};
private static string GetPrefixOfNamespace (XNamespace ns)
{
string namespaceName = ns.NamespaceName;
if (namespaceName.Length == 0)
return string.Empty;
if (namespaceName == XNamespace.Xml.NamespaceName)
return "xml";
if (namespaceName == XNamespace.Xmlns.NamespaceName)
return "xmlns";
return null;
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
sb.Append (name.ToString ());
sb.Append ("=\"");
int start = 0;
do {
int idx = value.IndexOfAny (escapeChars, start);
if (idx < 0) {
if (start > 0)
sb.Append (value, start, value.Length - start);
else
sb.Append (value);
sb.Append ("\"");
return sb.ToString ();
using (StringWriter sw = new StringWriter (CultureInfo.InvariantCulture)) {
XmlWriterSettings ws = new XmlWriterSettings ();
ws.ConformanceLevel = ConformanceLevel.Fragment;
using (XmlWriter w = XmlWriter.Create (sw, ws)) {
w.WriteAttributeString (GetPrefixOfNamespace (Name.Namespace), Name.LocalName,
Name.NamespaceName, Value);
}
sb.Append (value, start, idx - start);
switch (value [idx]) {
case '&': sb.Append ("&amp;"); break;
case '<': sb.Append ("&lt;"); break;
case '>': sb.Append ("&gt;"); break;
case '"': sb.Append ("&quot;"); break;
case '\r': sb.Append ("&#xD;"); break;
case '\n': sb.Append ("&#xA;"); break;
case '\t': sb.Append ("&#x9;"); break;
}
start = idx + 1;
} while (true);
return sw.ToString ().Trim ();
}
}
}
}

View File

@@ -205,6 +205,14 @@ namespace MonoTests.System.Xml.Linq
Assert.AreEqual ("a=\" &gt;_&lt; \"", a.ToString ());
}
[Test]
public void ToString_Xamarin29935 ()
{
var doc = XDocument.Parse ("<?xml version='1.0' encoding='utf-8'?><lift xmlns:test='http://test.example.com'></lift>");
Assert.AreEqual ("xmlns:test=\"http://test.example.com\"",
doc.Root.Attributes ().Select (s => s.ToString ()).First ());
}
[Test]
public void DateTimeAttribute ()
{

View File

@@ -7,7 +7,7 @@ using System.Security;
namespace System.Text
{
internal static class EncodingHelper
internal static partial class EncodingHelper
{
//
// Only internal, to be used by the class libraries: Unmarked and non-input-validating
@@ -71,6 +71,7 @@ internal static class EncodingHelper
[MethodImpl (MethodImplOptions.InternalCall)]
extern internal static string InternalCodePage (ref int code_page);
#if !MONOTOUCH
internal static Encoding GetDefaultEncoding ()
{
Encoding enc = null;
@@ -105,6 +106,7 @@ internal static class EncodingHelper
}
return enc;
}
#endif
// Loaded copy of the "I18N" assembly. We need to move
// this into a class in "System.Private" eventually.

View File

@@ -592,7 +592,7 @@ namespace System
public AdjustmentRule [] GetAdjustmentRules ()
{
if (!supportsDaylightSavingTime)
if (!supportsDaylightSavingTime || adjustmentRules == null)
return new AdjustmentRule [0];
else
return (AdjustmentRule []) adjustmentRules.Clone ();
@@ -1254,8 +1254,10 @@ namespace System
tz = CreateCustomTimeZone (id, baseUtcOffset, id, standardDisplayName, daylightDisplayName, ValidateRules (adjustmentRules).ToArray ());
}
if (storeTransition)
if (storeTransition && transitions.Count > 0) {
tz.transitions = transitions;
tz.supportsDaylightSavingTime = true;
}
return tz;
}

View File

@@ -1 +1 @@
a7e75eef6368c6220420fa94b92d9f18efdc954b
f38526856d8b1842bd8d401eb0d67765bff4c2cb

View File

@@ -1 +1 @@
2eb43af5239e63316874341249c70a7aaaa21548
c5f8a1c26efb5e43b4537118287011b39e48146e

View File

@@ -1 +1 @@
1e8e4cd027b107938b2ccffcb417211866ad1223
fab1f967bd41df8741fe07faecefc4570b2fa0a0

View File

@@ -1 +1 @@
c662727d3b509939685f97c0494d303020cc0725
02bc04de3431cb4492836a94aa678ff49f7a43b2

View File

@@ -1 +1 @@
134f3a9815c9cb89f775b433dcde3143b910e93c
b65949d5a9390ad455d5f54e6afffd8dedd94429