diff options
author | Jan Kotas <jkotas@microsoft.com> | 2016-03-21 09:06:54 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-03-21 17:39:02 -0700 |
commit | dfd9e1b097813e9ad9d02bd0a08a25c0cc4cae32 (patch) | |
tree | 56624c47f88bc2535298efe283282ca798c902e2 /src | |
parent | fc2246d77a951ac2111f242f3bb408af39903270 (diff) | |
download | coreclr-dfd9e1b097813e9ad9d02bd0a08a25c0cc4cae32.tar.gz coreclr-dfd9e1b097813e9ad9d02bd0a08a25c0cc4cae32.tar.bz2 coreclr-dfd9e1b097813e9ad9d02bd0a08a25c0cc4cae32.zip |
Delete legacy netcf compat support (part 1)
Diffstat (limited to 'src')
46 files changed, 26 insertions, 761 deletions
diff --git a/src/binder/applicationcontext.cpp b/src/binder/applicationcontext.cpp index d62091048f..27f860e927 100644 --- a/src/binder/applicationcontext.cpp +++ b/src/binder/applicationcontext.cpp @@ -459,13 +459,7 @@ namespace BINDER_SPACE SAFE_NEW(pNewAssemblyIdentity, AssemblyIdentityUTF8); sTextualIdentity.SetUTF8(szTextualIdentity); - - BOOL fWindowsPhone7 = false; -#ifdef FEATURE_LEGACYNETCF - fWindowsPhone7 = RuntimeIsLegacyNetCF(GetAppDomainId()); -#endif // FEATURE_LEGACYNETCF - - IF_FAIL_GO(TextualIdentityParser::Parse(sTextualIdentity, pNewAssemblyIdentity, fWindowsPhone7)); + IF_FAIL_GO(TextualIdentityParser::Parse(sTextualIdentity, pNewAssemblyIdentity)); IF_FAIL_GO(m_assemblyIdentityCache.Add(szTextualIdentity, pNewAssemblyIdentity)); pNewAssemblyIdentity->PopulateUTF8Fields(); diff --git a/src/binder/assembly.cpp b/src/binder/assembly.cpp index 28827b6c26..f528128187 100644 --- a/src/binder/assembly.cpp +++ b/src/binder/assembly.cpp @@ -16,10 +16,6 @@ #include "assembly.hpp" #include "utils.hpp" -#ifdef FEATURE_LEGACYNETCF -extern BOOL RuntimeIsLegacyNetCF(DWORD adid); -#endif - namespace BINDER_SPACE { namespace @@ -286,11 +282,6 @@ Exit: if (!IsPlatformArchicture(kArchitecture)) return TRUE; -#ifdef FEATURE_LEGACYNETCF - if (kArchitecture == peI386 && RuntimeIsLegacyNetCF(0)) - return TRUE; -#endif - return (kArchitecture == GetSystemArchitecture()); } diff --git a/src/md/runtime/metamodelro.cpp b/src/md/runtime/metamodelro.cpp index 3f01d105f6..0feb153a2f 100644 --- a/src/md/runtime/metamodelro.cpp +++ b/src/md/runtime/metamodelro.cpp @@ -389,10 +389,6 @@ CMiniMd::vSearchTableNotGreater( return S_OK; } // CMiniMd::vSearchTableNotGreater -#if defined(FEATURE_LEGACYNETCF) && defined(FEATURE_METADATA_IN_VM) -extern BOOL RuntimeIsLegacyNetCF(DWORD adid); -#endif - //***************************************************************************** // return just the blob value of the first found CA matching the query. // returns S_FALSE if there is no match @@ -444,11 +440,5 @@ CMiniMd::CommonGetCustomAttributeByNameEx( } ErrExit: -#if defined(FEATURE_LEGACYNETCF) && defined(FEATURE_METADATA_IN_VM) - // NetCF ignore malformed custom attribute tables - if (FAILED(hr) && RuntimeIsLegacyNetCF(0)) - hr = S_FALSE; -#endif - return hr; } // CMiniMd::CommonGetCustomAttributeByName diff --git a/src/mscorlib/src/System/AppDomain.cs b/src/mscorlib/src/System/AppDomain.cs index 8f876768bb..855564bd3d 100644 --- a/src/mscorlib/src/System/AppDomain.cs +++ b/src/mscorlib/src/System/AppDomain.cs @@ -2803,17 +2803,6 @@ namespace System { #endif // FEATURE_REMOTING -#if FEATURE_LEGACYNETCFFAS - public static IAppDomainPauseManager PauseManager - { - [System.Security.SecurityCritical] - get - { - return AppDomainPauseManager.Instance; - } - } -#endif // FEATURE_LEGACYNETCFFAS - #if !FEATURE_CORECLR // // Called by the VM if ICLRExecutionManager::Pause is called with the PAUSE_APP_DOMAINS flag. diff --git a/src/mscorlib/src/System/Array.cs b/src/mscorlib/src/System/Array.cs index 8130eeb6c5..ba74f87c33 100644 --- a/src/mscorlib/src/System/Array.cs +++ b/src/mscorlib/src/System/Array.cs @@ -1001,14 +1001,7 @@ namespace System { throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen")); Contract.EndContractBlock(); -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - return MangoArraySortHelper<T>.Default.BinarySearch(array, index, length, value, comparer); - else - return ArraySortHelper<T>.Default.BinarySearch(array, index, length, value, comparer); -#else return ArraySortHelper<T>.Default.BinarySearch(array, index, length, value, comparer); -#endif } public static TOutput[] ConvertAll<TInput, TOutput>(TInput[] array, Converter<TInput,TOutput> converter) { @@ -1808,15 +1801,8 @@ namespace System { return; } } - -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - MangoArraySortHelper<T>.Default.Sort(array, index, length, comparer); - else - ArraySortHelper<T>.Default.Sort(array, index, length, comparer); -#else + ArraySortHelper<T>.Default.Sort(array, index, length, comparer); -#endif } } @@ -1844,14 +1830,7 @@ namespace System { return; } -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - MangoArraySortHelper<TKey>.Default.Sort<TValue>(keys, items, index, length, comparer); - else - ArraySortHelper<TKey, TValue>.Default.Sort(keys, items, index, length, comparer); -#else ArraySortHelper<TKey, TValue>.Default.Sort(keys, items, index, length, comparer); -#endif } } diff --git a/src/mscorlib/src/System/Attribute.cs b/src/mscorlib/src/System/Attribute.cs index a9ea1f9d30..78fe095b3c 100644 --- a/src/mscorlib/src/System/Attribute.cs +++ b/src/mscorlib/src/System/Attribute.cs @@ -107,13 +107,7 @@ namespace System { rtPropAccessor = rtPropAccessor.GetParentDefinition(); if (rtPropAccessor != null) - { -#if FEATURE_LEGACYNETCF - // Mimicing NetCF which only looks for public properties. - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - return rtPropAccessor.DeclaringType.GetProperty(property.Name, property.PropertyType); -#endif //FEATURE_LEGACYNETCF - + { // There is a public overload of Type.GetProperty that takes both a BingingFlags enum and a return type. // However, we cannot use that because it doesn't accept null for "types". return rtPropAccessor.DeclaringType.GetProperty( @@ -123,7 +117,7 @@ namespace System { property.PropertyType, propertyParameters, //used for index properties null); - } + } } return null; diff --git a/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs b/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs index 0dac902ccd..5570c212f4 100644 --- a/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs +++ b/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs @@ -470,15 +470,7 @@ namespace System.Collections.Generic try { -#if FEATURE_LEGACYNETCF - // Pre-Apollo Windows Phone call the overload that sorts the keys, not values this achieves the same result - if (comparer == null && CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - comparer = Comparer<T>.Default; - - if (comparer == null || (comparer == Comparer<T>.Default && !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)) { -#else if (comparer == null || comparer == Comparer<T>.Default) { -#endif #if FEATURE_CORECLR // Since QuickSort and IntrospectiveSort produce different sorting sequence for equal keys the upgrade diff --git a/src/mscorlib/src/System/Collections/Generic/Comparer.cs b/src/mscorlib/src/System/Collections/Generic/Comparer.cs index b4f48bc57f..80c4cef9d6 100644 --- a/src/mscorlib/src/System/Collections/Generic/Comparer.cs +++ b/src/mscorlib/src/System/Collections/Generic/Comparer.cs @@ -51,18 +51,9 @@ namespace System.Collections.Generic RuntimeType t = (RuntimeType)typeof(T); // If T implements IComparable<T> return a GenericComparer<T> -#if FEATURE_LEGACYNETCF - // Pre-Apollo Windows Phone call the overload that sorts the keys, not values this achieves the same result - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - if (t.ImplementInterface(typeof(IComparable<T>))) { - return (Comparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(GenericComparer<int>), t); - } + if (typeof(IComparable<T>).IsAssignableFrom(t)) { + return (Comparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(GenericComparer<int>), t); } - else -#endif - if (typeof(IComparable<T>).IsAssignableFrom(t)) { - return (Comparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(GenericComparer<int>), t); - } // If T is a Nullable<U> where U implements IComparable<U> return a NullableComparer<U> if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) { diff --git a/src/mscorlib/src/System/Convert.cs b/src/mscorlib/src/System/Convert.cs index 982bddfc03..d1468314f2 100644 --- a/src/mscorlib/src/System/Convert.cs +++ b/src/mscorlib/src/System/Convert.cs @@ -2398,17 +2398,6 @@ namespace System { if (inArray == null) throw new ArgumentNullException("inArray"); -#if FEATURE_LEGACYNETCF - Contract.EndContractBlock(); - - // throw FormatException, to ensure compatibility with Mango Apps. - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - if(inArray.Length == 0) { - throw new FormatException(); - } - } -#endif - if (length < 0) throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_Index")); @@ -2418,9 +2407,7 @@ namespace System { if (offset > inArray.Length - length) throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_OffsetLength")); -#if !FEATURE_LEGACYNETCF // Our compat workaround above breaks CCRewrite's rules on valid contracts. Contract.EndContractBlock(); -#endif unsafe { fixed (Char* inArrayPtr = inArray) { diff --git a/src/mscorlib/src/System/DateTime.cs b/src/mscorlib/src/System/DateTime.cs index 6a496ac9d2..757623a9aa 100644 --- a/src/mscorlib/src/System/DateTime.cs +++ b/src/mscorlib/src/System/DateTime.cs @@ -920,14 +920,6 @@ namespace System { long ticks = 0; ticks = GetSystemTimeAsFileTime(); -#if FEATURE_LEGACYNETCF - // Windows Phone 7.0/7.1 return the ticks up to millisecond, not up to the 100th nanosecond. - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - { - long ticksms = ticks / TicksPerMillisecond; - ticks = ticksms * TicksPerMillisecond; - } -#endif return new DateTime( ((UInt64)(ticks + FileTimeOffset)) | KindUtc); } } diff --git a/src/mscorlib/src/System/DefaultBinder.cs b/src/mscorlib/src/System/DefaultBinder.cs index da419d7f36..405055e844 100644 --- a/src/mscorlib/src/System/DefaultBinder.cs +++ b/src/mscorlib/src/System/DefaultBinder.cs @@ -596,14 +596,7 @@ namespace System { // Allow a null indexes array. But if it is not null, every element must be non-null as well. if (indexes != null && !Contract.ForAll(indexes, delegate(Type t) { return t != null; })) { - Exception e; // Written this way to pass the Code Contracts style requirements. -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - e = new NullReferenceException(); - else -#endif - e = new ArgumentNullException("indexes"); - throw e; + throw new ArgumentNullException("indexes"); } if (match == null || match.Length == 0) throw new ArgumentException(Environment.GetResourceString("Arg_EmptyArray"), "match"); diff --git a/src/mscorlib/src/System/Delegate.cs b/src/mscorlib/src/System/Delegate.cs index a786c3079f..110555423c 100644 --- a/src/mscorlib/src/System/Delegate.cs +++ b/src/mscorlib/src/System/Delegate.cs @@ -349,23 +349,6 @@ namespace System { return CreateDelegate(type, target, method, ignoreCase, true); } -#if FEATURE_LEGACYNETCF - private static void CheckGetMethodInfo_Quirk(Type type, Type target, String method, BindingFlags bindingFlags) - { - ParameterInfo[] parameters = type.GetMethod("Invoke", BindingFlags.Public | BindingFlags.Instance).GetParameters(); - - Type[] types = new Type[parameters.Length]; - for (Int32 i = 0; i < parameters.Length; i++) - types[i] = parameters[i].ParameterType; - - MethodInfo mInfo = target.GetMethod(method, bindingFlags, null, types, null); - if (mInfo == null) - throw new MissingMethodException(target.FullName, method); - } -#endif - - - // V1 API. [System.Security.SecuritySafeCritical] // auto-generated public static Delegate CreateDelegate(Type type, Object target, String method, bool ignoreCase, bool throwOnBindFailure) @@ -384,15 +367,6 @@ namespace System { if (!rtType.IsDelegate()) throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"),"type"); -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - CheckGetMethodInfo_Quirk(type, target.GetType(), method, - BindingFlags.NonPublic | - BindingFlags.Public | - BindingFlags.Instance | - (ignoreCase?BindingFlags.IgnoreCase:0)); -#endif - Delegate d = InternalAlloc(rtType); // This API existed in v1/v1.1 and only expected to create closed // instance delegates. Constrain the call to BindToMethodName to such @@ -450,15 +424,6 @@ namespace System { if (!rtType.IsDelegate()) throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"),"type"); -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - CheckGetMethodInfo_Quirk(type, target, method, - BindingFlags.NonPublic | - BindingFlags.Public | - BindingFlags.Static | - (ignoreCase?BindingFlags.IgnoreCase:0)); -#endif - Delegate d = InternalAlloc(rtType); // This API existed in v1/v1.1 and only expected to create open // static delegates. Constrain the call to BindToMethodName to such @@ -701,13 +666,6 @@ namespace System { [System.Security.SecurityCritical] internal static Delegate UnsafeCreateDelegate(RuntimeType rtType, RuntimeMethodInfo rtMethod, Object firstArgument, DelegateBindingFlags flags) { - -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - if(rtMethod.IsGenericMethodDefinition) - throw new MissingMethodException(rtMethod.DeclaringType.FullName, rtMethod.Name); -#endif - Delegate d = InternalAlloc(rtType); if (d.BindToMethodInfo(firstArgument, rtMethod, rtMethod.GetDeclaringTypeInternal(), flags)) diff --git a/src/mscorlib/src/System/Environment.cs b/src/mscorlib/src/System/Environment.cs index 5828c0f2e4..dcf32b3a94 100644 --- a/src/mscorlib/src/System/Environment.cs +++ b/src/mscorlib/src/System/Environment.cs @@ -1147,14 +1147,6 @@ namespace System { PlatformID id = PlatformID.Unix; #else PlatformID id = PlatformID.Win32NT; - -#if FEATURE_LEGACYNETCF - // return platform as WinCE, to ensure apps earlier than WP8 works as expected. - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - { - id = PlatformID.WinCE; - } -#endif #endif // PLATFORM_UNIX Version v = new Version(osvi.MajorVersion, osvi.MinorVersion, osvi.BuildNumber, (osviEx.ServicePackMajor << 16) |osviEx.ServicePackMinor); diff --git a/src/mscorlib/src/System/Globalization/CultureData.cs b/src/mscorlib/src/System/Globalization/CultureData.cs index eee49e3c05..a15025c390 100644 --- a/src/mscorlib/src/System/Globalization/CultureData.cs +++ b/src/mscorlib/src/System/Globalization/CultureData.cs @@ -1194,14 +1194,6 @@ namespace System.Globalization { this.sLocalizedDisplayName = this.SLOCALIZEDLANGUAGE; } -#if FEATURE_LEGACYNETCF - // NetCF renders Invariant DisplayName differently from Windows - // Quirk it for NetCF apps - else if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && object.ReferenceEquals(this, s_Invariant)) - { - this.sLocalizedDisplayName = this.SLOCALIZEDLANGUAGE; - } -#endif else { // We have to make the neutral distinction in case the OS returns a specific name diff --git a/src/mscorlib/src/System/Globalization/CultureInfo.cs b/src/mscorlib/src/System/Globalization/CultureInfo.cs index 84f6f388cf..7193b8cfd7 100644 --- a/src/mscorlib/src/System/Globalization/CultureInfo.cs +++ b/src/mscorlib/src/System/Globalization/CultureInfo.cs @@ -330,24 +330,10 @@ namespace System.Globalization { } Contract.EndContractBlock(); -#if FEATURE_LEGACYNETCF - // Windows Phone 7 and 7.1 do not support Bengali. When running on Windows Phone 8, - // WinPhone 7.x apps get the old Mango text stack, not the Apollo text stack. The Mango - // text stack cannot display characters in Bengali, such as the culture's native name. - // Phone apps are already written to catch an exception here and bypass this culture. - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && - (name == "bn" || name == "bn-BD" || name == "bn-IN" || name == "ml" || name == "or")) - throw new ArgumentException(Environment.GetResourceString("Argument_CultureNotSupported")); -#endif - // Get our data providing record this.m_cultureData = CultureData.GetCultureData(name, useUserOverride); if (this.m_cultureData == null) { -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - throw new PlatformNotSupportedException(Environment.GetResourceString("Argument_CultureNotSupported")); -#endif throw new CultureNotFoundException("name", name, Environment.GetResourceString("Argument_CultureNotSupported")); } @@ -900,21 +886,6 @@ namespace System.Globalization { } } -#if FEATURE_LEGACYNETCF - // - // Helper methods to set default thread culture without security demand. Used - // by NetCF compatibility quirk. See comment in Thread.CurrentUICulture setter for details. - // - internal static void SetCurrentUICultureQuirk(CultureInfo value) { - s_DefaultThreadCurrentUICulture = value; - } - - internal static void SetCurrentCultureQuirk(CultureInfo value) { - s_DefaultThreadCurrentCulture = value; - } -#endif - - //////////////////////////////////////////////////////////////////////// // // InvariantCulture diff --git a/src/mscorlib/src/System/IAppDomainPauseManager.cs b/src/mscorlib/src/System/IAppDomainPauseManager.cs index 156a05343e..7e031454a4 100644 --- a/src/mscorlib/src/System/IAppDomainPauseManager.cs +++ b/src/mscorlib/src/System/IAppDomainPauseManager.cs @@ -20,23 +20,8 @@ namespace System using System.Runtime.Versioning; using System.Runtime.CompilerServices; -#if FEATURE_LEGACYNETCFFAS [System.Security.SecurityCritical] - public interface IAppDomainPauseManager - { - void Pausing(); - void Paused(); - void Resuming(); - void Resumed(); - } -#endif - - [System.Security.SecurityCritical] -#if FEATURE_LEGACYNETCFFAS - public class AppDomainPauseManager : IAppDomainPauseManager -#else internal class AppDomainPauseManager -#endif { [System.Security.SecurityCritical] public AppDomainPauseManager() diff --git a/src/mscorlib/src/System/IO/Directory.cs b/src/mscorlib/src/System/IO/Directory.cs index 2a1d4aecc1..95f2f37d2f 100644 --- a/src/mscorlib/src/System/IO/Directory.cs +++ b/src/mscorlib/src/System/IO/Directory.cs @@ -61,21 +61,6 @@ namespace System.IO { throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty")); Contract.EndContractBlock(); -#if FEATURE_LEGACYNETCF - if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - System.Reflection.Assembly callingAssembly = System.Reflection.Assembly.GetCallingAssembly(); - if(callingAssembly != null && !callingAssembly.IsProfileAssembly) { - string caller = new System.Diagnostics.StackFrame(1).GetMethod().FullName; - string callee = System.Reflection.MethodBase.GetCurrentMethod().FullName; - throw new MethodAccessException(String.Format( - CultureInfo.CurrentCulture, - Environment.GetResourceString("Arg_MethodAccessException_WithCaller"), - caller, - callee)); - } - } -#endif // FEATURE_LEGACYNETCF - return InternalCreateDirectoryHelper(path, true); } diff --git a/src/mscorlib/src/System/IO/FileInfo.cs b/src/mscorlib/src/System/IO/FileInfo.cs index 3ca3cb6d12..3ab1a5122e 100644 --- a/src/mscorlib/src/System/IO/FileInfo.cs +++ b/src/mscorlib/src/System/IO/FileInfo.cs @@ -66,23 +66,6 @@ namespace System.IO { throw new ArgumentNullException("fileName"); Contract.EndContractBlock(); -#if FEATURE_LEGACYNETCF - if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - { - System.Reflection.Assembly callingAssembly = System.Reflection.Assembly.GetCallingAssembly(); - if(callingAssembly != null && !callingAssembly.IsProfileAssembly) - { - string caller = new System.Diagnostics.StackFrame(1).GetMethod().FullName; - string callee = System.Reflection.MethodBase.GetCurrentMethod().FullName; - throw new MethodAccessException(String.Format( - CultureInfo.CurrentCulture, - Environment.GetResourceString("Arg_MethodAccessException_WithCaller"), - caller, - callee)); - } - } -#endif // FEATURE_LEGACYNETCF - Init(fileName, true); } diff --git a/src/mscorlib/src/System/IO/FileStream.cs b/src/mscorlib/src/System/IO/FileStream.cs index 9434acad7c..477b7b81c6 100644 --- a/src/mscorlib/src/System/IO/FileStream.cs +++ b/src/mscorlib/src/System/IO/FileStream.cs @@ -377,14 +377,6 @@ namespace System.IO { { internal const int DefaultBufferSize = 4096; - -#if FEATURE_LEGACYNETCF - // Mango didn't do support Async IO. - private static readonly bool _canUseAsync = !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8; -#else - private const bool _canUseAsync = true; -#endif //FEATURE_LEGACYNETCF - private byte[] _buffer; // Shared read/write buffer. Alloc on first use. private String _fileName; // Fully qualified file name. private bool _isAsync; // Whether we opened the handle for overlapped IO @@ -414,58 +406,16 @@ namespace System.IO { [System.Security.SecuritySafeCritical] public FileStream(String path, FileMode mode) : this(path, mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.Read, DefaultBufferSize, FileOptions.None, Path.GetFileName(path), false, false, true) { -#if FEATURE_LEGACYNETCF - if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - System.Reflection.Assembly callingAssembly = System.Reflection.Assembly.GetCallingAssembly(); - if(callingAssembly != null && !callingAssembly.IsProfileAssembly) { - string caller = new System.Diagnostics.StackFrame(1).GetMethod().FullName; - string callee = System.Reflection.MethodBase.GetCurrentMethod().FullName; - throw new MethodAccessException(String.Format( - CultureInfo.CurrentCulture, - Environment.GetResourceString("Arg_MethodAccessException_WithCaller"), - caller, - callee)); - } - } -#endif // FEATURE_LEGACYNETCF } [System.Security.SecuritySafeCritical] public FileStream(String path, FileMode mode, FileAccess access) : this(path, mode, access, FileShare.Read, DefaultBufferSize, FileOptions.None, Path.GetFileName(path), false, false, true) { -#if FEATURE_LEGACYNETCF - if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - System.Reflection.Assembly callingAssembly = System.Reflection.Assembly.GetCallingAssembly(); - if(callingAssembly != null && !callingAssembly.IsProfileAssembly) { - string caller = new System.Diagnostics.StackFrame(1).GetMethod().FullName; - string callee = System.Reflection.MethodBase.GetCurrentMethod().FullName; - throw new MethodAccessException(String.Format( - CultureInfo.CurrentCulture, - Environment.GetResourceString("Arg_MethodAccessException_WithCaller"), - caller, - callee)); - } - } -#endif // FEATURE_LEGACYNETCF } [System.Security.SecuritySafeCritical] public FileStream(String path, FileMode mode, FileAccess access, FileShare share) : this(path, mode, access, share, DefaultBufferSize, FileOptions.None, Path.GetFileName(path), false, false, true) { -#if FEATURE_LEGACYNETCF - if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - System.Reflection.Assembly callingAssembly = System.Reflection.Assembly.GetCallingAssembly(); - if(callingAssembly != null && !callingAssembly.IsProfileAssembly) { - string caller = new System.Diagnostics.StackFrame(1).GetMethod().FullName; - string callee = System.Reflection.MethodBase.GetCurrentMethod().FullName; - throw new MethodAccessException(String.Format( - CultureInfo.CurrentCulture, - Environment.GetResourceString("Arg_MethodAccessException_WithCaller"), - caller, - callee)); - } - } -#endif // FEATURE_LEGACYNETCF } [System.Security.SecuritySafeCritical] @@ -765,7 +715,7 @@ namespace System.IO { // WRT async IO, do the right thing for whatever platform we're on. // This way, someone can easily write code that opens a file // asynchronously no matter what their platform is. - if (_canUseAsync && (options & FileOptions.Asynchronous) != 0) + if ((options & FileOptions.Asynchronous) != 0) _isAsync = true; else options &= ~FileOptions.Asynchronous; @@ -953,7 +903,7 @@ namespace System.IO { int handleType = Win32Native.GetFileType(_handle); Contract.Assert(handleType == Win32Native.FILE_TYPE_DISK || handleType == Win32Native.FILE_TYPE_PIPE || handleType == Win32Native.FILE_TYPE_CHAR, "FileStream was passed an unknown file type!"); - _isAsync = isAsync && _canUseAsync; + _isAsync = isAsync; _canRead = 0 != (access & FileAccess.Read); _canWrite = 0 != (access & FileAccess.Write); _canSeek = handleType == Win32Native.FILE_TYPE_DISK; diff --git a/src/mscorlib/src/System/IO/Path.cs b/src/mscorlib/src/System/IO/Path.cs index 509e27be25..0b9c32098e 100644 --- a/src/mscorlib/src/System/IO/Path.cs +++ b/src/mscorlib/src/System/IO/Path.cs @@ -163,10 +163,6 @@ namespace System.IO { if (path != null) { CheckInvalidPathChars(path); -#if FEATURE_LEGACYNETCF - if (!CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { -#endif - string normalizedPath = NormalizePath(path, false); // If there are no permissions for PathDiscovery to this path, we should NOT expand the short paths @@ -207,24 +203,13 @@ namespace System.IO { path = normalizedPath; -#if FEATURE_LEGACYNETCF - } -#endif - int root = GetRootLength(path); int i = path.Length; if (i > root) { i = path.Length; if (i == root) return null; while (i > root && path[--i] != DirectorySeparatorChar && path[i] != AltDirectorySeparatorChar); - String dir = path.Substring(0, i); -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - if (dir.Length >= MaxPath - 1) - throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong")); - } -#endif - return dir; + return path.Substring(0, i); } } return null; diff --git a/src/mscorlib/src/System/Reflection/AssemblyName.cs b/src/mscorlib/src/System/Reflection/AssemblyName.cs index bd8372483e..a271f76d59 100644 --- a/src/mscorlib/src/System/Reflection/AssemblyName.cs +++ b/src/mscorlib/src/System/Reflection/AssemblyName.cs @@ -217,12 +217,7 @@ namespace System.Reflection { // will fail to load. public byte[] GetPublicKey() { -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && _PublicKey == null) - return EmptyArray<Byte>.Value; - else -#endif - return _PublicKey; + return _PublicKey; } public void SetPublicKey(byte[] publicKey) diff --git a/src/mscorlib/src/System/Reflection/ConstructorInfo.cs b/src/mscorlib/src/System/Reflection/ConstructorInfo.cs index 5db3a4c159..4d918ed039 100644 --- a/src/mscorlib/src/System/Reflection/ConstructorInfo.cs +++ b/src/mscorlib/src/System/Reflection/ConstructorInfo.cs @@ -562,12 +562,6 @@ namespace System.Reflection // ctor is generic or on a generic class else if (declaringType.ContainsGenericParameters) { -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - throw new ArgumentException( - String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Acc_CreateGenericEx"), declaringType)); - else -#endif throw new MemberAccessException( String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Acc_CreateGenericEx"), declaringType)); } diff --git a/src/mscorlib/src/System/Reflection/CustomAttribute.cs b/src/mscorlib/src/System/Reflection/CustomAttribute.cs index 5512a95e7d..76dd619458 100644 --- a/src/mscorlib/src/System/Reflection/CustomAttribute.cs +++ b/src/mscorlib/src/System/Reflection/CustomAttribute.cs @@ -1860,20 +1860,6 @@ namespace System.Reflection IntPtr blobStart = caRecord.blob.Signature; IntPtr blobEnd = (IntPtr)((byte*)blobStart + caRecord.blob.Length); -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - try - { - // Resolve attribute type from ctor parent token found in decorated decoratedModule scope - attributeType = decoratedModule.ResolveType(scope.GetParentToken(caRecord.tkCtor), null, null) as RuntimeType; - } - catch(Exception) - { - return false; - } - } - else -#endif // Resolve attribute type from ctor parent token found in decorated decoratedModule scope attributeType = decoratedModule.ResolveType(scope.GetParentToken(caRecord.tkCtor), null, null) as RuntimeType; diff --git a/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs index 67efd072cb..693e2d3660 100644 --- a/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs +++ b/src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs @@ -56,11 +56,7 @@ namespace System.Reflection.Emit { // Use this function if client decides to form the custom attribute blob themselves -#if FEATURE_CORECLR && !FEATURE_LEGACYNETCF - [System.Security.SecurityCritical] -#else [System.Security.SecuritySafeCritical] -#endif [System.Runtime.InteropServices.ComVisible(true)] public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { diff --git a/src/mscorlib/src/System/Reflection/FieldInfo.cs b/src/mscorlib/src/System/Reflection/FieldInfo.cs index 2ca1c5e71e..fca3c25470 100644 --- a/src/mscorlib/src/System/Reflection/FieldInfo.cs +++ b/src/mscorlib/src/System/Reflection/FieldInfo.cs @@ -517,11 +517,6 @@ namespace System.Reflection { if (target == null) { -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - throw new ArgumentNullException(Environment.GetResourceString("RFLCT.Targ_StatFldReqTarg")); - else -#endif throw new TargetException(Environment.GetResourceString("RFLCT.Targ_StatFldReqTarg")); } else diff --git a/src/mscorlib/src/System/Reflection/ParameterInfo.cs b/src/mscorlib/src/System/Reflection/ParameterInfo.cs index 591575f6ca..6ab0321f66 100644 --- a/src/mscorlib/src/System/Reflection/ParameterInfo.cs +++ b/src/mscorlib/src/System/Reflection/ParameterInfo.cs @@ -578,11 +578,6 @@ namespace System.Reflection if (defaultValue == DBNull.Value) { #region Handle case if no default value was found -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - defaultValue = null; - else -#endif if (IsOptional) { // If the argument is marked as optional then the default value is Missing.Value. diff --git a/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs b/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs index 83718fef9f..fe0c5a5c45 100644 --- a/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs +++ b/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs @@ -220,17 +220,6 @@ namespace System.Resources { [System.Security.SecurityCritical] internal static CultureInfo GetNeutralResourcesLanguage(Assembly a, ref UltimateResourceFallbackLocation fallbackLocation) { - -#if FEATURE_LEGACYNETCF - // Windows Phone 7.0/7.1 ignore NeutralResourceLanguage attribute and - // defaults fallbackLocation to MainAssembly - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - { - fallbackLocation = UltimateResourceFallbackLocation.MainAssembly; - return CultureInfo.InvariantCulture; - } -#endif - Contract.Assert(a != null, "assembly != null"); string cultureName = null; short fallback = 0; diff --git a/src/mscorlib/src/System/String.cs b/src/mscorlib/src/System/String.cs index 727679d524..9c4c9e0ad5 100644 --- a/src/mscorlib/src/System/String.cs +++ b/src/mscorlib/src/System/String.cs @@ -2736,22 +2736,6 @@ namespace System { Contract.EndContractBlock(); return this; } - - private static bool IsBOMWhitespace(char c) - { -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && c == '\xFEFF') - { - // Dev11 450846 quirk: - // NetCF treats the BOM as a whitespace character when performing trim operations. - return true; - } - else -#endif - { - return false; - } - } // Trims the whitespace from both ends of the string. Whitespace is defined by // Char.IsWhiteSpace. @@ -2775,13 +2759,13 @@ namespace System { //Trim specified characters. if (trimType !=TrimTail) { for (start=0; start < this.Length; start++) { - if (!Char.IsWhiteSpace(this[start]) && !IsBOMWhitespace(this[start])) break; + if (!Char.IsWhiteSpace(this[start])) break; } } if (trimType !=TrimHead) { for (end= Length -1; end >= start; end--) { - if (!Char.IsWhiteSpace(this[end]) && !IsBOMWhitespace(this[start])) break; + if (!Char.IsWhiteSpace(this[end])) break; } } @@ -2966,21 +2950,7 @@ namespace System { Contract.Ensures(Contract.Result<String>() != null); Contract.EndContractBlock(); - string s = ReplaceInternal(oldValue, newValue); -#if FEATURE_LEGACYNETCF - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhoneMango) - { - int i = s.IndexOf('\0'); - if (i > 0) - return s.Substring(0, i); - else - return s; - } - else -#endif - { - return s; - } + return ReplaceInternal(oldValue, newValue); } [System.Security.SecuritySafeCritical] // auto-generated diff --git a/src/mscorlib/src/System/Text/StringBuilder.cs b/src/mscorlib/src/System/Text/StringBuilder.cs index 317f82d251..e5d0fcdab0 100644 --- a/src/mscorlib/src/System/Text/StringBuilder.cs +++ b/src/mscorlib/src/System/Text/StringBuilder.cs @@ -581,22 +581,14 @@ namespace System.Text { // Appends an array of characters at the end of this string builder. The capacity is adjusted as needed. [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Append(char[] value, int startIndex, int charCount) { - // in NetCF arguments pretty much don't matter as long as count is 0 - // we need to check this twice, as this is a contract area and we can't return from here -#if FEATURE_LEGACYNETCF - if (startIndex < 0 && !(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && (charCount == 0))) { -#else if (startIndex < 0) { -#endif //FEATURE_LEGACYNETCF throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive")); } if (charCount<0) { throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive")); } -#if !FEATURE_LEGACYNETCF // Avoid contract problems with compat switch above. Contract.Ensures(Contract.Result<StringBuilder>() != null); Contract.EndContractBlock(); -#endif // in NetCF arguments pretty much don't matter as long as count is 0 if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && (charCount == 0)) @@ -685,22 +677,14 @@ namespace System.Text { // count at the end of this string builder. [System.Security.SecuritySafeCritical] // auto-generated public StringBuilder Append(String value, int startIndex, int count) { - // in NetCF arguments pretty much don't matter as long as count is 0 - // we need to check this twice, as this is a contract area and we can't return from here -#if FEATURE_LEGACYNETCF - if (startIndex < 0 && !(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && (count == 0))) { -#else if (startIndex < 0) { -#endif //FEATURE_LEGACYNETCF throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_Index")); } if (count < 0) { throw new ArgumentOutOfRangeException("count", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive")); } -#if !FEATURE_LEGACYNETCF // The use of CompatibilitySwitches above prevents us from marking this as a precondition. Contract.Ensures(Contract.Result<StringBuilder>() != null); -#endif // in NetCF arguments pretty much don't matter as long as count is 0 if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 && (count == 0)){ @@ -1435,14 +1419,6 @@ namespace System.Text { if (s == null) { IFormattable formattableArg = arg as IFormattable; -#if FEATURE_LEGACYNETCF - if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { - // TimeSpan does not implement IFormattable in Mango - if(arg is TimeSpan) { - formattableArg = null; - } - } -#endif if (formattableArg != null) { if (sFmt == null && fmt != null) { sFmt = fmt.ToString(); diff --git a/src/mscorlib/src/System/Threading/Thread.cs b/src/mscorlib/src/System/Threading/Thread.cs index 7871e91773..bec60326f6 100644 --- a/src/mscorlib/src/System/Threading/Thread.cs +++ b/src/mscorlib/src/System/Threading/Thread.cs @@ -517,22 +517,6 @@ namespace System.Threading { #pragma warning restore 618 public void Abort() { -#if FEATURE_LEGACYNETCF - if(CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - { - System.Reflection.Assembly callingAssembly = System.Reflection.Assembly.GetCallingAssembly(); - if(callingAssembly != null && !callingAssembly.IsProfileAssembly) - { - string caller = new StackFrame(1).GetMethod().FullName; - string callee = System.Reflection.MethodBase.GetCurrentMethod().FullName; - throw new MethodAccessException(String.Format( - CultureInfo.CurrentCulture, - Environment.GetResourceString("Arg_MethodAccessException_WithCaller"), - caller, - callee)); - } - } -#endif // FEATURE_LEGACYNETCF AbortInternal(); } @@ -1104,14 +1088,6 @@ namespace System.Threading { nativeInitCultureAccessors(); #endif -#if FEATURE_LEGACYNETCF && !FEATURE_COREFX_GLOBALIZATION - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - { - // Maintain legacy NetCF Behavior where setting the value for one thread impacts all threads. - CultureInfo.SetCurrentUICultureQuirk(value); - return; - } -#endif if (!AppContextSwitches.NoAsyncCurrentCulture) { if (s_asyncLocalCurrentUICulture == null) @@ -1219,14 +1195,6 @@ namespace System.Threading { nativeInitCultureAccessors(); #endif -#if FEATURE_LEGACYNETCF && !FEATURE_COREFX_GLOBALIZATION - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - { - // See comment in CurrentUICulture setter - CultureInfo.SetCurrentCultureQuirk(value); - return; - } -#endif if (!AppContextSwitches.NoAsyncCurrentCulture) { if (s_asyncLocalCurrentCulture == null) diff --git a/src/mscorlib/src/System/Threading/ThreadPool.cs b/src/mscorlib/src/System/Threading/ThreadPool.cs index f9d8e7da98..2ee7b76f89 100644 --- a/src/mscorlib/src/System/Threading/ThreadPool.cs +++ b/src/mscorlib/src/System/Threading/ThreadPool.cs @@ -1830,12 +1830,6 @@ namespace System.Threading [CLSCompliant(false)] unsafe public static bool UnsafeQueueNativeOverlapped(NativeOverlapped* overlapped) { -#if FEATURE_CORECLR && !FEATURE_LEGACYNETCF - if(Environment.OSVersion.Platform == PlatformID.MacOSX) - throw new NotSupportedException(Environment.GetResourceString("Arg_NotSupportedException")); - Contract.EndContractBlock(); -#endif - return PostQueuedCompletionStatus(overlapped); } @@ -1934,12 +1928,6 @@ namespace System.Threading #pragma warning restore 618 public static bool BindHandle(SafeHandle osHandle) { - #if FEATURE_CORECLR && !FEATURE_LEGACYNETCF - if(Environment.OSVersion.Platform == PlatformID.MacOSX) - throw new NotSupportedException(Environment.GetResourceString("Arg_NotSupportedException")); - Contract.EndContractBlock(); - #endif - if (osHandle == null) throw new ArgumentNullException("osHandle"); diff --git a/src/mscorlib/src/System/Threading/WaitHandle.cs b/src/mscorlib/src/System/Threading/WaitHandle.cs index 6bca19125d..30d6872741 100644 --- a/src/mscorlib/src/System/Threading/WaitHandle.cs +++ b/src/mscorlib/src/System/Threading/WaitHandle.cs @@ -329,13 +329,6 @@ namespace System.Threading waitHandles = null; #endif -#if FEATURE_LEGACYNETCF - // WinCE did not support "wait all." It turns out that this resulted in NetCF's WaitAll implementation always returning true. - // Unfortunately, some apps took a dependency on that, so we have to replicate the behavior here. - if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) - return true; -#endif - int ret = WaitMultiple(internalWaitHandles, millisecondsTimeout, exitContext, true /* waitall*/ ); if(AppDomainPauseManager.IsPaused) diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp index 1c807f5d21..699835409d 100644 --- a/src/tools/crossgen/crossgen.cpp +++ b/src/tools/crossgen/crossgen.cpp @@ -159,11 +159,6 @@ void PrintUsageHelper() W(" /ReadyToRun - Generate images resilient to the runtime and\n") W(" dependency versions\n") #endif -#ifdef FEATURE_LEGACYNETCF - W(" Compatability Modes\n") - W(" /PreWP8App - Set the Windows Phone 8 \"Quirks\" mode, namely AppDomainCompatSwitch=\n") - W(" WindowsPhone_3.7.0.0 or WindowsPhone_3.8.0.0.\n") -#endif #ifdef FEATURE_WINMD_RESILIENT W(" WinMD Parameters\n") W(" /WinMDResilient - Generate images resilient to WinMD dependency changes.\n") @@ -532,12 +527,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) // fulltrust behaviour. } #endif -#ifdef FEATURE_LEGACYNETCF - else if (MatchParameter(*argv, W("PreWP8App"))) - { - dwFlags |= NGENWORKER_FLAGS_APPCOMPATWP8; - } -#endif #ifdef FEATURE_WINMD_RESILIENT else if (MatchParameter(*argv, W("WinMDResilient"))) { diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 3d64ebc8bc..3e46941959 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -2902,12 +2902,6 @@ BOOL Module::IsNoStringInterning() // Default is string interning BOOL fNoStringInterning = FALSE; -#ifdef FEATURE_LEGACYNETCF - // NetCF ignored this attribute - if (GetAppDomain()->GetAppDomainCompatMode() != BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - { -#endif - HRESULT hr; // This flag applies to assembly, but it is stored on module so it can be cached in ngen image @@ -2941,10 +2935,6 @@ BOOL Module::IsNoStringInterning() } } -#ifdef FEATURE_LEGACYNETCF - } -#endif - #ifdef _DEBUG static ConfigDWORD g_NoStringInterning; DWORD dwOverride = g_NoStringInterning.val(CLRConfig::INTERNAL_NoStringInterning); diff --git a/src/vm/class.h b/src/vm/class.h index cad0e0f49c..78c09000e3 100644 --- a/src/vm/class.h +++ b/src/vm/class.h @@ -1677,18 +1677,6 @@ public: /* no op */ } #endif -#ifdef FEATURE_LEGACYNETCF - DWORD IsTypeValidOnNetCF() - { - LIMITED_METHOD_CONTRACT; - return (m_VMFlags & VMFLAG_TYPE_VALID_ON_NETCF); - } - void SetTypeValidOnNetCF() - { - WRAPPER_NO_CONTRACT; - FastInterlockOr(EnsureWritablePages(&m_VMFlags), VMFLAG_TYPE_VALID_ON_NETCF); - } -#endif DWORD HasNonPublicFields() { LIMITED_METHOD_CONTRACT; @@ -2159,9 +2147,6 @@ public: #ifdef FEATURE_REMOTING VMFLAG_CANNOT_BE_BLITTED_BY_OBJECT_CLONER = 0x00000100, // This class has GC type fields, or implements ISerializable or has non-Serializable fields #endif -#ifdef FEATURE_LEGACYNETCF - VMFLAG_TYPE_VALID_ON_NETCF = 0x00000100, // This type would succesfully load on NetCF -#endif VMFLAG_IS_EQUIVALENT_TYPE = 0x00000200, diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp index 086f202873..1b8b3eed58 100644 --- a/src/vm/clsload.cpp +++ b/src/vm/clsload.cpp @@ -4473,12 +4473,7 @@ VOID ClassLoader::AddAvailableClassHaveLock( // been obfuscated so that they have duplicate private typedefs. // We must allow this for old assemblies for app compat reasons #ifdef FEATURE_CORECLR -#ifdef FEATURE_LEGACYNETCF - if (!RuntimeIsLegacyNetCF(0)) -#endif - { - pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME); - } + pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME); #else LPCSTR pszVersion = NULL; if (FAILED(pModule->GetMDImport()->GetVersionString(&pszVersion))) diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp index 27a2d00735..5b0a952cd3 100644 --- a/src/vm/comdelegate.cpp +++ b/src/vm/comdelegate.cpp @@ -698,12 +698,6 @@ FCIMPL5(FC_BOOL_RET, COMDelegate::BindToMethodName, // performance gain in some reflection emit scenarios. MethodTable::AllowMethodDataCaching(); -#ifdef FEATURE_LEGACYNETCF - // NetCF has done relaxed signature matching unconditionally - if (GetAppDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - flags |= DBF_RelaxedSignature; -#endif - TypeHandle targetType((gc.target != NULL) ? gc.target->GetTrueMethodTable() : NULL); // get the invoke of the delegate MethodTable * pDelegateType = gc.refThis->GetMethodTable(); diff --git a/src/vm/commodule.cpp b/src/vm/commodule.cpp index 41e7aa16e2..7cab6b54f2 100644 --- a/src/vm/commodule.cpp +++ b/src/vm/commodule.cpp @@ -871,12 +871,6 @@ void QCALLTYPE COMModule::GetType(QCall::ModuleHandle pModule, LPCWSTR wszName, BOOL prohibitAsmQualifiedName = TRUE; -#ifdef FEATURE_LEGACYNETCF - // // NetCF type name parser allowed assembly name to be overriden here - if (GetAppDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - prohibitAsmQualifiedName = FALSE; -#endif - // Load the class from this assembly (fail if it is in a different one). retTypeHandle = TypeName::GetTypeManaged(wszName, pAssembly, bThrowOnError, bIgnoreCase, pAssembly->IsIntrospectionOnly(), prohibitAsmQualifiedName, NULL, FALSE, &keepAlive); } diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index 5c77d608a8..e16f9d8ab5 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -3804,13 +3804,6 @@ DWORD DomainAssembly::ComputeDebuggingConfig() { dacfFlags |= DACF_USER_OVERRIDE; } -#ifdef FEATURE_LEGACYNETCF - else - if (GetAppDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - { - // NetCF did not respect the DebuggableAttribute - } -#endif else { IfFailThrow(GetDebuggingCustomAttributes(&dacfFlags)); diff --git a/src/vm/invokeutil.cpp b/src/vm/invokeutil.cpp index 2211dfeffd..42e5a86249 100644 --- a/src/vm/invokeutil.cpp +++ b/src/vm/invokeutil.cpp @@ -2016,11 +2016,6 @@ AccessCheckOptions::AccessCheckType InvokeUtil::GetInvocationAccessCheckType(BOO // There is no security concern because we are in Full Trust. return AccessCheckOptions::kRestrictedMemberAccessNoTransparency; -#ifdef FEATURE_LEGACYNETCF - if (pAppDomain->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - return AccessCheckOptions::kRestrictedMemberAccess; -#endif // FEATURE_LEGACYNETCF - return AccessCheckOptions::kMemberAccess; #else // !FEATURE_CORECLR diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 9c47f6d944..0a5154aa4f 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -1453,43 +1453,6 @@ static CorInfoHelpFunc getInstanceFieldHelper(FieldDesc * pField, CORINFO_ACCESS return (CorInfoHelpFunc)helper; } -#ifdef FEATURE_LEGACYNETCF -void CheckValidTypeOnNetCF(MethodTable * pMT) -{ - STANDARD_VM_CONTRACT; - - // Do this quirk for application assemblies only - if (pMT->GetAssembly()->GetManifestFile()->IsProfileAssembly()) - return; - - if (pMT->GetClass()->IsTypeValidOnNetCF()) - return; - - DWORD dwStaticsSizeOnNetCF = 0; - - // - // NetCF had 64k limit on total size of statics per class. This limit - // is easy to reach by initialized data in C#. Apps took dependency - // on type load exceptions being thrown in this case. - // - ApproxFieldDescIterator fieldIterator(pMT, ApproxFieldDescIterator::STATIC_FIELDS); - for (FieldDesc *pFD = fieldIterator.Next(); pFD != NULL; pFD = fieldIterator.Next()) - { - DWORD fldSize = pFD->LoadSize(); - - // Simulate NetCF behaviour that caused size to wrap around - dwStaticsSizeOnNetCF += (UINT16)fldSize; - - if (dwStaticsSizeOnNetCF > 0xFFFF) - COMPlusThrow(kTypeLoadException); - } - - // Cache the result of the check - pMT->GetClass()->SetTypeValidOnNetCF(); -} -#endif // FEATURE_LEGACYNETCF - - /*********************************************************************/ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, @@ -1520,11 +1483,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, pResult->offset = pField->GetOffset(); if (pField->IsStatic()) { -#ifdef FEATURE_LEGACYNETCF - if (pFieldMT->GetDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - CheckValidTypeOnNetCF(pFieldMT); -#endif - fieldFlags |= CORINFO_FLG_FIELD_STATIC; if (pField->IsRVA()) @@ -3943,18 +3901,6 @@ CorInfoInitClassResult CEEInfo::initClass( if (pFD == NULL) { -#ifdef FEATURE_LEGACYNETCF - // For methods, NetCF always triggers static constructor as side-effect of JITing, essentially ignoring before field init. - if (pTypeToInitMT->GetDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - { - // This quirk assumes that RunCCTorAsIfNGenImageExists() is TRUE. It would need to be replicated in more places - // if it was not the case. - _ASSERTE(pTypeToInitMT->RunCCTorAsIfNGenImageExists()); - - fIgnoreBeforeFieldInit = true; - } -#endif - if (!fIgnoreBeforeFieldInit && pTypeToInitMT->GetClass()->IsBeforeFieldInit()) { // We can wait for field accesses to run .cctor @@ -7304,20 +7250,6 @@ CorInfoInline CEEInfo::canInline (CORINFO_METHOD_HANDLE hCaller, { Module * pCalleeModule = pCallee->GetModule(); -#ifdef FEATURE_LEGACYNETCF - if (m_pMethodBeingCompiled->GetDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - { - // NetCF did not allow cross-assembly inlining (except for mscorlib) - // and leaf methods - Assembly * pCalleeAssembly = pCalleeModule->GetAssembly(); - Assembly * pOrigCallerAssembly = pOrigCallerModule->GetAssembly(); - if ((pCalleeAssembly != pOrigCallerAssembly) && !pCalleeAssembly->IsSystem()) - { - dwRestrictions |= INLINE_RESPECT_BOUNDARY; - } - } -#endif // FEATURE_LEGACYNETCF - #ifdef FEATURE_PREJIT Assembly * pCalleeAssembly = pCalleeModule->GetAssembly(); @@ -7946,17 +7878,6 @@ bool CEEInfo::canTailCall (CORINFO_METHOD_HANDLE hCaller, _ASSERTE((pExactCallee == NULL) || pExactCallee->GetModule()); _ASSERTE((pExactCallee == NULL) || pExactCallee->GetModule()->GetClassLoader()); -#ifdef FEATURE_LEGACYNETCF - // NetCF did not implement tail calls - if (m_pMethodBeingCompiled->GetDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - { - - result = false; - szFailReason = "Windows Phone OS 7 compatibility"; - goto exit; - } -#endif // FEATURE_LEGACYNETCF - // If the caller is the static constructor (.cctor) of a class which has a ComImport base class // somewhere up the class hierarchy, then we cannot make the call into a tailcall. See // RegisterObjectCreationCallback() in ExtensibleClassFactory.cpp for more information. @@ -11736,14 +11657,6 @@ CorJitResult CallCompileMethodWithSEHWrapper(EEJitManager *jitMgr, } } -#ifdef FEATURE_LEGACYNETCF - // for "AppDomainCompatSwitch" == "WindowsPhone_3.7.0.0" or "AppDomainCompatSwitch" == "WindowsPhone_3.8.0.0" - // This is when we need to generate code that more closely resembles - // what the WinPhone 7.0/7.1/7.5 NetCF JIT used to generate. - if (ftn->GetDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - flags |= CORJIT_FLG_NETCF_QUIRKS; -#endif // FEATURE_LEGACYNETCF - return flags; } diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index 5d291081c7..8a5c19043c 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -952,23 +952,9 @@ MethodTableBuilder::MethodSignature::SignaturesEquivalent( { STANDARD_VM_CONTRACT; -#ifdef FEATURE_LEGACYNETCF - BaseDomain::AppDomainCompatMode compatMode1 = sig1.GetModule()->GetDomain()->GetAppDomainCompatMode(); - BaseDomain::AppDomainCompatMode compatMode2 = sig2.GetModule()->GetDomain()->GetAppDomainCompatMode(); - - if ((compatMode1 == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) || (compatMode2 == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8)) - { - return S_OK == MetaSig::CompareMethodSigsNT( - sig1.GetSignature(), static_cast<DWORD>(sig1.GetSignatureLength()), sig1.GetModule(), &sig1.GetSubstitution(), - sig2.GetSignature(), static_cast<DWORD>(sig2.GetSignatureLength()), sig2.GetModule(), &sig2.GetSubstitution()); - } - else -#endif - { - return !!MetaSig::CompareMethodSigs( - sig1.GetSignature(), static_cast<DWORD>(sig1.GetSignatureLength()), sig1.GetModule(), &sig1.GetSubstitution(), - sig2.GetSignature(), static_cast<DWORD>(sig2.GetSignatureLength()), sig2.GetModule(), &sig2.GetSubstitution()); - } + return !!MetaSig::CompareMethodSigs( + sig1.GetSignature(), static_cast<DWORD>(sig1.GetSignatureLength()), sig1.GetModule(), &sig1.GetSubstitution(), + sig2.GetSignature(), static_cast<DWORD>(sig2.GetSignatureLength()), sig2.GetModule(), &sig2.GetSubstitution()); } //******************************************************************************* @@ -979,27 +965,11 @@ MethodTableBuilder::MethodSignature::SignaturesExactlyEqual( { STANDARD_VM_CONTRACT; -#ifdef FEATURE_LEGACYNETCF - BaseDomain::AppDomainCompatMode compatMode1 = sig1.GetModule()->GetDomain()->GetAppDomainCompatMode(); - BaseDomain::AppDomainCompatMode compatMode2 = sig2.GetModule()->GetDomain()->GetAppDomainCompatMode(); - - if ((compatMode1 == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) || (compatMode2 == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8)) - { - TokenPairList newVisited = TokenPairList::AdjustForTypeEquivalenceForbiddenScope(NULL); - return S_OK == MetaSig::CompareMethodSigsNT( - sig1.GetSignature(), static_cast<DWORD>(sig1.GetSignatureLength()), sig1.GetModule(), &sig1.GetSubstitution(), - sig2.GetSignature(), static_cast<DWORD>(sig2.GetSignatureLength()), sig2.GetModule(), &sig2.GetSubstitution(), - &newVisited); - } - else -#endif - { - TokenPairList newVisited = TokenPairList::AdjustForTypeEquivalenceForbiddenScope(NULL); - return !!MetaSig::CompareMethodSigs( - sig1.GetSignature(), static_cast<DWORD>(sig1.GetSignatureLength()), sig1.GetModule(), &sig1.GetSubstitution(), - sig2.GetSignature(), static_cast<DWORD>(sig2.GetSignatureLength()), sig2.GetModule(), &sig2.GetSubstitution(), - &newVisited); - } + TokenPairList newVisited = TokenPairList::AdjustForTypeEquivalenceForbiddenScope(NULL); + return !!MetaSig::CompareMethodSigs( + sig1.GetSignature(), static_cast<DWORD>(sig1.GetSignatureLength()), sig1.GetModule(), &sig1.GetSubstitution(), + sig2.GetSignature(), static_cast<DWORD>(sig2.GetSignatureLength()), sig2.GetModule(), &sig2.GetSubstitution(), + &newVisited); } //******************************************************************************* @@ -3896,13 +3866,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, BOOL fFieldRequiresAlign8 = HasParent() ? GetParentMethodTable()->RequiresAlign8() : FALSE; #endif -#ifdef FEATURE_LEGACYNETCF - BOOL fNetCFCompat = GetModule()->GetDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8; - DWORD dwStaticsSizeOnNetCF = 0; -#else - const BOOL fNetCFCompat = FALSE; -#endif - for (i = 0; i < bmtMetaData->cFields; i++) { PCCOR_SIGNATURE pMemberSignature; @@ -4400,8 +4363,7 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, ); // Check if the ValueType field containing non-publics is overlapped - if (!fNetCFCompat - && HasExplicitFieldOffsetLayout() + if (HasExplicitFieldOffsetLayout() && pLayoutFieldInfo != NULL && pLayoutFieldInfo->m_fIsOverlapped && pByValueClass != NULL @@ -11498,11 +11460,6 @@ void MethodTableBuilder::VerifyVirtualMethodsImplemented(MethodTable::MethodData return; #endif // FEATURE_COMINTEROP -#ifdef FEATURE_LEGACYNETCF - if (GetModule()->GetDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - return; -#endif - // Since interfaces aren't laid out in the vtable for stub dispatch, what we need to do // is try to find an implementation for every interface contract by iterating through // the interfaces not declared on a parent. diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp index 220a3bbb91..f4abb5f2f5 100644 --- a/src/vm/pefile.cpp +++ b/src/vm/pefile.cpp @@ -306,11 +306,6 @@ void PEFile::ValidateImagePlatformNeutrality() fMachineOk = (machine == IMAGE_FILE_MACHINE_I386); fPlatformFlagsOk = ((kind & (peILonly | pe32Plus | pe32BitRequired)) == peILonly); - -#ifdef FEATURE_LEGACYNETCF - if (GetAppDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - fPlatformFlagsOk = ((kind & (peILonly | pe32Plus)) == peILonly); -#endif if (!(fMachineOk && fPlatformFlagsOk)) @@ -561,14 +556,6 @@ static void ValidatePEFileMachineType(PEFile *peFile) if (actualMachineType != IMAGE_FILE_MACHINE_NATIVE) { -#ifdef FEATURE_LEGACYNETCF - if (GetAppDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8) - { - if (actualMachineType == IMAGE_FILE_MACHINE_I386 && ((peKind & peILonly)) == peILonly) - return; - } -#endif - #ifdef _TARGET_AMD64_ // v4.0 64-bit compatibility workaround. The 64-bit v4.0 CLR's Reflection.Load(byte[]) api does not detect cpu-matches. We should consider fixing that in // the next SxS release. In the meantime, this bypass will retain compat for 64-bit v4.0 CLR for target platforms that existed at the time. @@ -4344,33 +4331,11 @@ void PEAssembly::VerifyStrongName() #endif // !defined(FEATURE_CORECLR) else { -#if defined(FEATURE_CORECLR) +#ifdef FEATURE_CORECLR // Runtime policy on CoreCLR is to skip verification of ALL assemblies m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS; m_fStrongNameVerified = TRUE; #else - -#ifdef FEATURE_CORECLR - BOOL skip = FALSE; - - // Skip verification for assemblies from the trusted path - if (IsSystem() || m_bIsOnTpaList) - skip = TRUE; - -#ifdef FEATURE_LEGACYNETCF - // crossgen should skip verification for Mango - if (RuntimeIsLegacyNetCF(0)) - skip = TRUE; -#endif - - if (skip) - { - m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS; - m_fStrongNameVerified = TRUE; - return; - } -#endif // FEATURE_CORECLR - DWORD verifyOutputFlags = 0; HRESULT hr = GetILimage()->VerifyStrongName(&verifyOutputFlags); diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp index edbb678502..164da1395e 100644 --- a/src/vm/reflectioninvocation.cpp +++ b/src/vm/reflectioninvocation.cpp @@ -521,34 +521,8 @@ FCIMPL6(Object*, RuntimeTypeHandle::CreateInstance, ReflectClassBaseObject* refT HELPER_METHOD_FRAME_BEGIN_RET_2(rv, refThis); -#ifdef FEATURE_LEGACYNETCF - BOOL fNetCFCompat = GetAppDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8; -#else - const BOOL fNetCFCompat = FALSE; -#endif - MethodTable* pVMT; bool bNeedAccessCheck; - - if (fNetCFCompat && !thisTH.IsNull() && thisTH.IsArray()) - { - ArrayTypeDesc *atd = thisTH.AsArray(); - if (atd->GetTypeParam().IsArray()) - { - // We could do this, but Mango doesn't support creating - // arrays of arrays here - COMPlusThrow(kMissingMethodException,W("Arg_NoDefCTor")); - } - - INT32 rank = atd->GetRank(); - INT32* lengths = (INT32*) _alloca(sizeof(INT32) * rank); - for (INT32 i = 0; i < rank; ++i) - { - lengths[i] = 0; - } - rv = AllocateArrayEx(thisTH, lengths, rank); - goto Exit; - } // Get the type information associated with refThis if (thisTH.IsNull() || thisTH.IsTypeDesc()) @@ -736,8 +710,7 @@ FCIMPL6(Object*, RuntimeTypeHandle::CreateInstance, ReflectClassBaseObject* refT } } } - -Exit: + HELPER_METHOD_FRAME_END(); return OBJECTREFToObject(rv); } diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp index 114a710463..85c81f75db 100644 --- a/src/vm/securitymeta.cpp +++ b/src/vm/securitymeta.cpp @@ -1612,15 +1612,6 @@ void ModuleSecurityDescriptor::VerifyDataComputed() AssemblySecurityDescriptor *pAssemSecDesc = static_cast<AssemblySecurityDescriptor*>(pAssembly->GetSecurityDescriptor()); -#ifdef FEATURE_LEGACYNETCF - // Legacy Mango apps have incorrect transparency attributes, so quirk to ignore them and force - // opportunistic criticality - if (GetAppDomain()->GetAppDomainCompatMode() == BaseDomain::APPDOMAINCOMPAT_APP_EARLIER_THAN_WP8 && !pAssemSecDesc->IsMicrosoftPlatform()) - { - moduleFlags = ModuleSecurityDescriptorFlags_IsOpportunisticallyCritical | ModuleSecurityDescriptorFlags_IsAPTCA; - } -#endif // FEATURE_LEGACYNETCF - // We shouldn't be both all transparent and all critical const ModuleSecurityDescriptorFlags invalidMask = ModuleSecurityDescriptorFlags_IsAllCritical | ModuleSecurityDescriptorFlags_IsAllTransparent; diff --git a/src/vm/staticallocationhelpers.inl b/src/vm/staticallocationhelpers.inl index a6440f62cc..26c2573762 100644 --- a/src/vm/staticallocationhelpers.inl +++ b/src/vm/staticallocationhelpers.inl @@ -122,13 +122,6 @@ static BOOL GetStaticFieldElementTypeForFieldDef(Module * pModule, IMDInternalIm HRESULT hr = pImport->GetCustomAttributeByName((mdToken)field, g_ThreadStaticAttributeClassName, NULL, NULL); - -#if defined(FEATURE_LEGACYNETCF) - // Replicate quirk from code:CMiniMd::CommonGetCustomAttributeByNameEx - if (FAILED(hr) && RuntimeIsLegacyNetCF(0)) - hr = S_FALSE; -#endif - IfFailThrow(hr); // Use one set of variables for regular statics, and the other set for thread statics |