diff options
Diffstat (limited to 'src/mscorlib/src/System/Globalization/CultureInfo.cs')
-rw-r--r-- | src/mscorlib/src/System/Globalization/CultureInfo.cs | 98 |
1 files changed, 1 insertions, 97 deletions
diff --git a/src/mscorlib/src/System/Globalization/CultureInfo.cs b/src/mscorlib/src/System/Globalization/CultureInfo.cs index 9f306c3c99..ba61c146f6 100644 --- a/src/mscorlib/src/System/Globalization/CultureInfo.cs +++ b/src/mscorlib/src/System/Globalization/CultureInfo.cs @@ -36,7 +36,6 @@ namespace System.Globalization { using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; - using System.Security.Permissions; using System.Reflection; using Microsoft.Win32; using System.Diagnostics; @@ -44,7 +43,6 @@ namespace System.Globalization { using System.Resources; [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public partial class CultureInfo : ICloneable, IFormatProvider { //--------------------------------------------------------------------// // Internal Information // @@ -82,10 +80,6 @@ namespace System.Globalization { [NonSerialized]internal CultureData m_cultureData; [NonSerialized]internal bool m_isInherited; -#if FEATURE_LEAK_CULTURE_INFO - [NonSerialized]private bool m_isSafeCrossDomain; - [NonSerialized]private int m_createdDomainID; -#endif // !FEATURE_LEAK_CULTURE_INFO [NonSerialized]private CultureInfo m_consoleFallbackCulture; // Names are confusing. Here are 3 names we have: @@ -370,25 +364,6 @@ namespace System.Globalization { } #endif // FEATURE_USE_LCID - // - // CheckDomainSafetyObject throw if the object is customized object which cannot be attached to - // other object (like CultureInfo or DateTimeFormatInfo). - // - - internal static void CheckDomainSafetyObject(Object obj, Object container) - { - if (obj.GetType().Assembly != typeof(System.Globalization.CultureInfo).Assembly) { - - throw new InvalidOperationException( - String.Format( - CultureInfo.CurrentCulture, - Environment.GetResourceString("InvalidOperation_SubclassedObject"), - obj.GetType(), - container.GetType())); - } - Contract.EndContractBlock(); - } - #region Serialization // We need to store the override from the culture data record. private bool m_useUserOverride; @@ -421,21 +396,6 @@ namespace System.Globalization { } #endif m_isInherited = (this.GetType() != typeof(System.Globalization.CultureInfo)); - - // in case we have non customized CultureInfo object we shouldn't allow any customized object - // to be attached to it for cross app domain safety. - if (this.GetType().Assembly == typeof(System.Globalization.CultureInfo).Assembly) - { - if (textInfo != null) - { - CheckDomainSafetyObject(textInfo, this); - } - - if (compareInfo != null) - { - CheckDomainSafetyObject(compareInfo, this); - } - } } #if FEATURE_USE_LCID @@ -470,57 +430,8 @@ namespace System.Globalization { this.cultureID = this.m_cultureData.ILANGUAGE; #endif } -#endregion Serialization - -#if FEATURE_LEAK_CULTURE_INFO - // Is it safe to send this CultureInfo as an instance member of a Thread cross AppDomain boundaries? - // For Silverlight, the answer is always no. - internal bool IsSafeCrossDomain { - get { - Debug.Assert(m_createdDomainID != 0, "[CultureInfo.IsSafeCrossDomain] m_createdDomainID != 0"); - return m_isSafeCrossDomain; - } - } - - internal int CreatedDomainID { - get { - Debug.Assert(m_createdDomainID != 0, "[CultureInfo.CreatedDomain] m_createdDomainID != 0"); - return m_createdDomainID; - } - } - - internal void StartCrossDomainTracking() { - - // If we have decided about cross domain safety of this instance, we are done - if (m_createdDomainID != 0) - return; - - // If FEATURE_LEAK_CULTURE_INFO isn't enabled, we never want to pass - // CultureInfo as an instance member of a Thread. - if (CanSendCrossDomain()) - { - m_isSafeCrossDomain = true; - } - - // m_createdDomainID has to be assigned last. We use it to signal that we have - // completed the check. - System.Threading.Thread.MemoryBarrier(); - m_createdDomainID = Thread.GetDomainID(); - } -#endif // FEATURE_LEAK_CULTURE_INFO - // Is it safe to pass the CultureInfo cross AppDomain boundaries, not necessarily as an instance - // member of Thread. This is different from IsSafeCrossDomain, which implies passing the CultureInfo - // as a Thread instance member. - internal bool CanSendCrossDomain() - { - bool isSafe = false; - if (this.GetType() == typeof(System.Globalization.CultureInfo)) - { - isSafe = true; - } - return isSafe; - } +#endregion Serialization // Constructor called by SQL Server's special munged culture - creates a culture with // a TextInfo and CompareInfo that come from a supplied alternate source. This object @@ -949,7 +860,6 @@ namespace System.Globalization { // //////////////////////////////////////////////////////////////////////// #if FEATURE_USE_LCID - [System.Runtime.InteropServices.ComVisible(false)] public virtual int KeyboardLayoutId { get @@ -1010,7 +920,6 @@ namespace System.Globalization { } } - [System.Runtime.InteropServices.ComVisible(false)] public String IetfLanguageTag { get @@ -1258,7 +1167,6 @@ namespace System.Globalization { } } - [System.Runtime.InteropServices.ComVisible(false)] public CultureTypes CultureTypes { get @@ -1473,7 +1381,6 @@ namespace System.Globalization { } } - [System.Runtime.InteropServices.ComVisible(false)] public CultureInfo GetConsoleFallbackUICulture() { Contract.Ensures(Contract.Result<CultureInfo>() != null); @@ -1885,9 +1792,6 @@ namespace System.Globalization { [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern int nativeGetLocaleInfoExInt(String localeName, uint field); - [MethodImplAttribute(MethodImplOptions.InternalCall)] - internal static extern bool nativeSetThreadLocale(String localeName); - private static String GetDefaultLocaleName(int localeType) { Debug.Assert(localeType == LOCALE_USER_DEFAULT || localeType == LOCALE_SYSTEM_DEFAULT, "[CultureInfo.GetDefaultLocaleName] localeType must be LOCALE_USER_DEFAULT or LOCALE_SYSTEM_DEFAULT"); |