From a8192fbc7064ed96cfeb8872bcb6479c217f7b5f Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Thu, 29 Oct 2015 19:09:52 -0700 Subject: Port .NET Framework 4.6.1 changes Core runtime and GC changes from https://github.com/Microsoft/dotnet/blob/master/docs/releases/net461/dotnet461-changes.md that are not in CoreCLR yet [tfs-changeset: 1543382] --- src/mscorlib/src/System/AppContext/AppContext.cs | 4 ++- .../Collections/Concurrent/ConcurrentDictionary.cs | 5 ++-- .../Eventing/TraceLogging/SimpleTypeInfos.cs | 16 +++++------ .../src/System/Globalization/CultureData.cs | 33 ++++------------------ src/mscorlib/src/mscorlib.txt | 2 +- 5 files changed, 20 insertions(+), 40 deletions(-) (limited to 'src/mscorlib') diff --git a/src/mscorlib/src/System/AppContext/AppContext.cs b/src/mscorlib/src/System/AppContext/AppContext.cs index d1416f7af1..feef21b787 100644 --- a/src/mscorlib/src/System/AppContext/AppContext.cs +++ b/src/mscorlib/src/System/AppContext/AppContext.cs @@ -26,7 +26,9 @@ namespace System #endif get { - return AppDomain.CurrentDomain.BaseDirectory; + // The value of APP_CONTEXT_BASE_DIRECTORY key has to be a string and it is not allowed to be any other type. + // Otherwise the caller will get invalid cast exception + return (string) AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY") ?? AppDomain.CurrentDomain.BaseDirectory; } } diff --git a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs index 38085b8d4f..f15cb00198 100644 --- a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs +++ b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs @@ -84,10 +84,9 @@ namespace System.Collections.Concurrent // that generate collisions. Whenever a GrowTable() should be the only place that changes this #if !FEATURE_CORECLR // The field should be have been marked as NonSerialized but because we shipped it without that attribute in 4.5.1. - // we have to also add the OptionalField attribute to prevent cases where the field was serialized and we try to deserialize it after the fix. - // See DevDiv:899074 for more information + // we can't add it back without breaking compat. To maximize compat we are going to keep the OptionalField attribute + // This will prevent cases where the field was not serialized. [OptionalField] - [NonSerialized] #endif private int m_keyRehashCount; diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs index 6490a3a2dd..461ed76a0f 100644 --- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs +++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs @@ -656,7 +656,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (Byte)value; + return value; } } @@ -678,7 +678,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (SByte)value; + return value; } } @@ -700,7 +700,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (Int16)value; + return value; } } @@ -722,7 +722,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (UInt16)value; + return value; } } @@ -744,7 +744,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (Int32)value; + return value; } } @@ -766,7 +766,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (UInt32)value; + return value; } } @@ -788,7 +788,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (Int64)value; + return value; } } @@ -810,7 +810,7 @@ namespace System.Diagnostics.Tracing public override object GetData(object value) { - return (UInt64)value; + return value; } } diff --git a/src/mscorlib/src/System/Globalization/CultureData.cs b/src/mscorlib/src/System/Globalization/CultureData.cs index 9911ef35cf..fa8926bfaf 100644 --- a/src/mscorlib/src/System/Globalization/CultureData.cs +++ b/src/mscorlib/src/System/Globalization/CultureData.cs @@ -1180,24 +1180,10 @@ namespace System.Globalization if (this.sLocalizedDisplayName == null) { #if !FEATURE_CORECLR - if (this.IsSupplementalCustomCulture) + String resourceKey = "Globalization.ci_" + this.sName; + if (IsResourcePresent(resourceKey)) { - if (this.IsNeutralCulture) - { - this.sLocalizedDisplayName = this.SNATIVELANGUAGE; - } - else - { - this.sLocalizedDisplayName = this.SNATIVEDISPLAYNAME; - } - } - else - { - String resourceKey = "Globalization.ci_" + this.sName; - if (IsResourcePresent(resourceKey)) - { - this.sLocalizedDisplayName = Environment.GetResourceString(resourceKey); - } + this.sLocalizedDisplayName = Environment.GetResourceString(resourceKey); } #endif // If it hasn't been found (Windows 8 and up), fallback to the system @@ -1518,17 +1504,10 @@ namespace System.Globalization if (this.sLocalizedCountry == null) { #if !FEATURE_CORECLR - if (this.IsSupplementalCustomCulture) - { - this.sLocalizedCountry = SNATIVECOUNTRY; - } - else + String resourceKey = "Globalization.ri_" + this.SREGIONNAME; + if (IsResourcePresent(resourceKey)) { - String resourceKey = "Globalization.ri_" + this.SREGIONNAME; - if (IsResourcePresent(resourceKey)) - { - this.sLocalizedCountry = Environment.GetResourceString(resourceKey); - } + this.sLocalizedCountry = Environment.GetResourceString(resourceKey); } #endif // If it hasn't been found (Windows 8 and up), fallback to the system diff --git a/src/mscorlib/src/mscorlib.txt b/src/mscorlib/src/mscorlib.txt index 6435d1c85d..2298b2065d 100644 --- a/src/mscorlib/src/mscorlib.txt +++ b/src/mscorlib/src/mscorlib.txt @@ -2647,7 +2647,7 @@ Globalization.ci_ewo = Ewondo Globalization.ci_ewo-CM = Ewondo (Cameroon) Globalization.ci_fa = Persian Globalization.ci_fa-AF = Persian (Afghanistan) -Globalization.ci_fa-IR = Persian +Globalization.ci_fa-IR = Persian (Iran) Globalization.ci_ff = Fulah Globalization.ci_ff-CM = Fulah (Cameroon) Globalization.ci_ff-GN = Fulah (Guinea) -- cgit v1.2.3