Imported Upstream version 4.0.1.28

Former-commit-id: 7bed21f7f097faf1b23b151908aba1976234cb6e
This commit is contained in:
Jo Shields
2015-05-15 09:04:39 +01:00
parent 7272927785
commit 2e0d90627e
155 changed files with 2071 additions and 1163 deletions

View File

@ -353,8 +353,7 @@ namespace System.Runtime.Serialization.Json
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
if (!reader.IsStartElement ("item"))
throw SerializationError (String.Format ("Expected element 'item', but found '{0}' in namespace '{1}'", reader.LocalName, reader.NamespaceURI));
Type et = elementType == typeof (object) || elementType.IsAbstract ? null : elementType;
object elem = ReadObject (et ?? typeof (object));
object elem = ReadObject (elementType);
c.Add (elem);
}
#if NET_2_1

View File

@ -2,6 +2,8 @@ Assembly/AssemblyInfo.cs
../../build/common/Consts.cs
../../build/common/Locale.cs
../../build/common/MonoTODOAttribute.cs
../../../external/referencesource/System.Xml/System/Xml/Bits.cs
System.Xml/XsdDateTime2.cs
Mono.Xml.Schema/XmlSchemaValidatingReader.cs
Mono.Xml.Schema/XsdIdentityPath.cs
Mono.Xml.Schema/XsdIdentityState.cs

View File

@ -290,7 +290,16 @@ namespace System.Xml {
//return DateTime.Parse(s, d);
DateTimeStyles style = DateTimeStyles.AllowLeadingWhite |
DateTimeStyles.AllowTrailingWhite;
return DateTime.ParseExact (s, format, DateTimeFormatInfo.InvariantInfo, style);
try {
return DateTime.ParseExact (s, format, DateTimeFormatInfo.InvariantInfo, style);
} catch (Exception e) {
try {
var xsdDateTime = new XsdDateTime2 (s, XsdDateTimeFlags.AllXsd);
return (DateTime) xsdDateTime;
} catch {
throw e;
}
}
}
public static DateTime ToDateTime(string s, string[] formats)
@ -304,6 +313,13 @@ namespace System.Xml {
return DateTime.ParseExact (s, formats, DateTimeFormatInfo.InvariantInfo, style);
} catch (ArgumentOutOfRangeException) {
return DateTime.MinValue;
} catch (Exception e) {
try {
var xsdDateTime = new XsdDateTime2 (s, XsdDateTimeFlags.AllXsd);
return (DateTime) xsdDateTime;
} catch {
throw e;
}
}
}
@ -781,15 +797,35 @@ namespace System.Xml {
public static DateTimeOffset ToDateTimeOffset (string s, string format)
{
return DateTimeOffset.ParseExact (s, format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
try {
return DateTimeOffset.ParseExact (s, format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
} catch (Exception e) {
try {
var xsdDateTime = new XsdDateTime2 (s, XsdDateTimeFlags.AllXsd);
return (DateTimeOffset) xsdDateTime;
} catch {
throw e;
}
}
}
public static DateTimeOffset ToDateTimeOffset (string s, string [] formats)
{
DateTimeStyles style = DateTimeStyles.AllowLeadingWhite |
try {
DateTimeStyles style = DateTimeStyles.AllowLeadingWhite |
DateTimeStyles.AllowTrailingWhite |
DateTimeStyles.AssumeUniversal;
return DateTimeOffset.ParseExact (s, formats, CultureInfo.InvariantCulture, style);
return DateTimeOffset.ParseExact (s, formats, CultureInfo.InvariantCulture, style);
} catch (Exception e) {
try {
var xsdDateTime = new XsdDateTime2 (s, XsdDateTimeFlags.AllXsd);
return (DateTimeOffset) xsdDateTime;
} catch {
throw e;
}
}
}
public static string ToString (DateTimeOffset value)

File diff suppressed because it is too large Load Diff

View File

@ -371,4 +371,6 @@ System.Xml.Serialization/XmlElementEventHandler.cs
System.Xml.Serialization/XmlNodeEventHandler.cs
System.Xml/XQueryConvert.cs
../../../external/referencesource/System.Xml/System/Xml/Bits.cs
System.Xml/XsdDateTime2.cs

View File

@ -417,11 +417,12 @@ namespace System.Globalization
// The runtime returns a NULL in the first position of the array when
// 'neutral' is true. We fill it in with a clone of InvariantCulture
// since it must not be read-only
int i = 0;
if (neutral && infos.Length > 0 && infos [0] == null) {
infos [0] = (CultureInfo) InvariantCulture.Clone ();
infos [i++] = (CultureInfo) InvariantCulture.Clone ();
}
for (int i = 1; i < infos.Length; ++i) {
for (; i < infos.Length; ++i) {
var ci = infos [i];
infos [i].m_cultureData = CultureData.GetCultureData (ci.m_name, false, ci.datetime_index, ci.CalendarType, ci.iso2lang);
}

View File

@ -225,6 +225,15 @@ namespace MonoTests.System.Globalization
Assert.Fail ("InvariantCulture not found in the array from GetCultures()");
}
[Test]
public void GetAllCultures_Specific ()
{
CultureInfo [] infos = CultureInfo.GetCultures (CultureTypes.SpecificCultures);
foreach (CultureInfo ci in infos) {
Assert.IsNotNull (ci.DateTimeFormat);
}
}
[Test]
#if !NET_4_0
[ExpectedException (typeof (NotSupportedException))]

View File

@ -0,0 +1 @@
#include corlib.dll.sources

View File

@ -1 +1 @@
4816a33a1117da3f621fc172ae972cb88e983fe0
62d516907d70ecf17d5514d0b95eca311ec777cf

View File

@ -1 +1 @@
d56b0642b5e7cef07830b8435781e7decd5a3c88
cd383f7f1e00c5c33b0d1ca418b3026590e16b82

View File

@ -1 +1 @@
f812e116ea4476a6400787d291a6c33982351043
0442610a0894deae436f4425d6ce61bfcf05f317

View File

@ -1 +1 @@
d5baf4466182688805ba46006f24dee0f2a58a7f
8b55e7bf143fa497a0beb1248953d8a153f92e6b

View File

@ -1 +1 @@
e634a26a89825c34d9fa548f211a6b2e1968da66
46943fbf58da39a463799c4588a4ae363eb08687

View File

@ -1 +1 @@
45516bac994827703522453286f3a1c1b8d75b1b
f5a92d1da2d627310094847f1caea53b06b9cb06

View File

@ -1 +1 @@
340def76e208dadff3d94c971334b503dee1dc4c
a41c331587790269dc8edeb917e32a18c54ab218

View File

@ -1 +1 @@
976d3a548faca8313dcbe8037ca0a8aa1d22b8da
520a0a38f7184d287366c996c5ac92d8e7f5fac2

View File

@ -204,18 +204,72 @@ namespace Mono.Linker.Steps {
MarkCustomAttributeFields (ca, type);
}
void MarkCustomAttributeProperties (CustomAttribute ca, TypeDefinition attribute)
protected void MarkSecurityDeclarations (ISecurityDeclarationProvider provider)
{
// most security declarations are removed (if linked) but user code might still have some
// and if the attribtues references types then they need to be marked too
if ((provider == null) || !provider.HasSecurityDeclarations)
return;
foreach (var sd in provider.SecurityDeclarations)
MarkSecurityDeclaration (sd);
}
protected virtual void MarkSecurityDeclaration (SecurityDeclaration sd)
{
if (!sd.HasSecurityAttributes)
return;
foreach (var sa in sd.SecurityAttributes)
MarkSecurityAttribute (sa);
}
protected virtual void MarkSecurityAttribute (SecurityAttribute sa)
{
TypeReference security_type = sa.AttributeType;
TypeDefinition type = security_type.Resolve ();
if (type == null)
throw new ResolutionException (security_type);
MarkType (security_type);
MarkSecurityAttributeProperties (sa, type);
MarkSecurityAttributeFields (sa, type);
}
protected void MarkSecurityAttributeProperties (SecurityAttribute sa, TypeDefinition attribute)
{
if (!sa.HasProperties)
return;
foreach (var named_argument in sa.Properties)
MarkCustomAttributeProperty (named_argument, attribute);
}
protected void MarkSecurityAttributeFields (SecurityAttribute sa, TypeDefinition attribute)
{
if (!sa.HasFields)
return;
foreach (var named_argument in sa.Fields)
MarkCustomAttributeField (named_argument, attribute);
}
protected void MarkCustomAttributeProperties (CustomAttribute ca, TypeDefinition attribute)
{
if (!ca.HasProperties)
return;
foreach (var named_argument in ca.Properties) {
PropertyDefinition property = GetProperty (attribute, named_argument.Name);
if (property != null)
MarkMethod (property.SetMethod);
foreach (var named_argument in ca.Properties)
MarkCustomAttributeProperty (named_argument, attribute);
}
MarkIfType (named_argument.Argument);
}
protected void MarkCustomAttributeProperty (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
{
PropertyDefinition property = GetProperty (attribute, namedArgument.Name);
if (property != null)
MarkMethod (property.SetMethod);
MarkIfType (namedArgument.Argument);
}
PropertyDefinition GetProperty (TypeDefinition type, string propertyname)
@ -231,18 +285,22 @@ namespace Mono.Linker.Steps {
return null;
}
void MarkCustomAttributeFields (CustomAttribute ca, TypeDefinition attribute)
protected void MarkCustomAttributeFields (CustomAttribute ca, TypeDefinition attribute)
{
if (!ca.HasFields)
return;
foreach (var named_argument in ca.Fields) {
FieldDefinition field = GetField (attribute, named_argument.Name);
if (field != null)
MarkField (field);
foreach (var named_argument in ca.Fields)
MarkCustomAttributeField (named_argument, attribute);
}
MarkIfType (named_argument.Argument);
}
protected void MarkCustomAttributeField (CustomAttributeNamedArgument namedArgument, TypeDefinition attribute)
{
FieldDefinition field = GetField (attribute, namedArgument.Name);
if (field != null)
MarkField (field);
MarkIfType (namedArgument.Argument);
}
FieldDefinition GetField (TypeDefinition type, string fieldname)
@ -306,7 +364,7 @@ namespace Mono.Linker.Steps {
return false;
}
void MarkAssembly (AssemblyDefinition assembly)
protected void MarkAssembly (AssemblyDefinition assembly)
{
if (CheckProcessed (assembly))
return;
@ -314,6 +372,7 @@ namespace Mono.Linker.Steps {
ProcessModule (assembly);
MarkCustomAttributes (assembly);
MarkSecurityDeclarations (assembly);
foreach (ModuleDefinition module in assembly.Modules)
MarkCustomAttributes (module);
@ -412,6 +471,7 @@ namespace Mono.Linker.Steps {
MarkType (type.BaseType);
MarkType (type.DeclaringType);
MarkCustomAttributes (type);
MarkSecurityDeclarations (type);
if (IsMulticastDelegate (type)) {
MarkMethodCollection (type.Methods);
@ -845,6 +905,7 @@ namespace Mono.Linker.Steps {
MarkType (method.DeclaringType);
MarkCustomAttributes (method);
MarkSecurityDeclarations (method);
MarkGenericParameterProvider (method);