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

@@ -358,6 +358,25 @@ namespace System.Globalization {
this.m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo));
}
private CultureInfo(CultureData cultureData)
{
Contract.Assert(cultureData != null);
m_cultureData = cultureData;
m_name = cultureData.CultureName;
m_isInherited = false;
}
private static CultureInfo CreateCultureInfoNoThrow(string name, bool useUserOverride)
{
Contract.Assert(name != null);
CultureData cultureData = CultureData.GetCultureData(name, useUserOverride);
if (cultureData == null)
{
return null;
}
return new CultureInfo(cultureData);
}
#if FEATURE_USE_LCID
public CultureInfo(int culture) : this(culture, true) {
@@ -958,29 +977,29 @@ namespace System.Globalization {
get
{
Contract.Ensures(Contract.Result<CultureInfo>() != null);
CultureInfo culture = null;
if (null == m_parent)
{
try
{
string parentName = this.m_cultureData.SPARENT;
string parentName = this.m_cultureData.SPARENT;
if (String.IsNullOrEmpty(parentName))
{
m_parent = InvariantCulture;
}
else
{
m_parent = new CultureInfo(parentName, this.m_cultureData.UseUserOverride);
}
}
catch (ArgumentException)
if (String.IsNullOrEmpty(parentName))
{
// For whatever reason our IPARENT or SPARENT wasn't correct, so use invariant
// We can't allow ourselves to fail. In case of custom cultures the parent of the
// current custom culture isn't installed.
m_parent = InvariantCulture;
culture = InvariantCulture;
}
else
{
culture = CreateCultureInfoNoThrow(parentName, m_cultureData.UseUserOverride);
if (culture == null)
{
// For whatever reason our IPARENT or SPARENT wasn't correct, so use invariant
// We can't allow ourselves to fail. In case of custom cultures the parent of the
// current custom culture isn't installed.
culture = InvariantCulture;
}
}
Interlocked.CompareExchange<CultureInfo>(ref m_parent, culture, null);
}
return m_parent;
}

View File

@@ -22,7 +22,6 @@ namespace System.Globalization {
** Taiwan 01/01/01 8088/12/31
============================================================================*/
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable] public class TaiwanCalendar: Calendar {
//