Remove the UseLatestBehaviorWhenTFMNotSpecified compat switch (dotnet/coreclr#5708)
authorAlexGhiondea <AlexGhiondea@users.noreply.github.com>
Wed, 19 Oct 2016 20:24:40 +0000 (13:24 -0700)
committerJan Kotas <jkotas@microsoft.com>
Wed, 19 Oct 2016 20:24:40 +0000 (13:24 -0700)
* Default to latest behavior when a TFM is not specified

Instead of requiring that a compatibility switch is set in order to get the
latest behavior for all AppContext switches that are based on TFM, have that
behavior on by default.

* Remove the UseLatestBehaviorWhenTFMNotSpecified compat switch

Commit migrated from https://github.com/dotnet/coreclr/commit/0e4869a6930cfb6278b51130bbccfc323ef61053

src/coreclr/src/coreclr/hosts/coreconsole/coreconsole.cpp
src/coreclr/src/coreclr/hosts/corerun/corerun.cpp
src/coreclr/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
src/coreclr/src/mscorlib/src/System/CompatibilitySwitches.cs
src/coreclr/src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs

index 1533dff..2af9115 100644 (file)
@@ -457,7 +457,6 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
         W("APP_PATHS"),
         W("APP_NI_PATHS"),
         W("NATIVE_DLL_SEARCH_DIRECTORIES"),
-        W("AppDomainCompatSwitch")
     };
     const wchar_t *property_values[] = { 
         // TRUSTED_PLATFORM_ASSEMBLIES
@@ -468,8 +467,6 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
         appNiPath,
         // NATIVE_DLL_SEARCH_DIRECTORIES
         nativeDllSearchDirs,
-        // AppDomainCompatSwitch
-        W("UseLatestBehaviorWhenTFMNotSpecified")
     };
 
 
index e7ddab2..0df2806 100644 (file)
@@ -495,7 +495,6 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
         W("APP_PATHS"),
         W("APP_NI_PATHS"),
         W("NATIVE_DLL_SEARCH_DIRECTORIES"),
-        W("AppDomainCompatSwitch"),
         W("APP_LOCAL_WINMETADATA")
     };
     const wchar_t *property_values[] = { 
@@ -507,8 +506,6 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
         appNiPath,
         // NATIVE_DLL_SEARCH_DIRECTORIES
         nativeDllSearchDirs,
-        // AppDomainCompatSwitch
-        W("UseLatestBehaviorWhenTFMNotSpecified"),
         // APP_LOCAL_WINMETADATA
         appLocalWinmetadata
     };
index b3a0c07..d7186d7 100644 (file)
@@ -379,7 +379,6 @@ int ExecuteManagedAssembly(
                 "APP_PATHS",
                 "APP_NI_PATHS",
                 "NATIVE_DLL_SEARCH_DIRECTORIES",
-                "AppDomainCompatSwitch",
                 "System.GC.Server",
             };
             const char *propertyValues[] = {
@@ -391,8 +390,6 @@ int ExecuteManagedAssembly(
                 appPath.c_str(),
                 // NATIVE_DLL_SEARCH_DIRECTORIES
                 nativeDllSearchDirs.c_str(),
-                // AppDomainCompatSwitch
-                "UseLatestBehaviorWhenTFMNotSpecified",
                 // System.GC.Server
                 useServerGc,
             };
index 7facf85..893a47e 100644 (file)
@@ -39,10 +39,6 @@ namespace System
 
         internal static void InitializeSwitches()
         {
-#if FEATURE_CORECLR
-            s_useLatestBehaviorWhenTFMNotSpecified = IsCompatibilitySwitchSet("UseLatestBehaviorWhenTFMNotSpecified");
-#endif //FEATURE_CORECLR
-
 #if !FEATURE_CORECLR
             s_isNetFx40TimeSpanLegacyFormatMode = IsCompatibilitySwitchSet("NetFx40_TimeSpanLegacyFormatMode");
             s_isNetFx40LegacySecurityPolicy = IsCompatibilitySwitchSet("NetFx40_LegacySecurityPolicy");
@@ -52,19 +48,7 @@ namespace System
             s_AreSwitchesSet = true;
         }
 
-#if FEATURE_CORECLR
-        /// <summary>
-        /// This property returns whether to give the latest behavior when the TFM is missing
-        /// </summary>
-        internal static bool UseLatestBehaviorWhenTFMNotSpecified
-        {
-            get
-            {
-                return s_useLatestBehaviorWhenTFMNotSpecified;
-            }
-        }
-#else //FEATURE_CORECLR
-
+#if !FEATURE_CORECLR
         public static bool IsAppEarlierThanSilverlight4
         {
             get
@@ -89,7 +73,7 @@ namespace System
             }
         }
 
-#endif //FEATURE_CORECLR
+#endif //!FEATURE_CORECLR
 
         public static bool IsNetFx40TimeSpanLegacyFormatMode
         {
index 99e30b5..e8c9c7d 100644 (file)
@@ -461,16 +461,7 @@ namespace System.Runtime.Versioning
             int fxVersion = 0;
             if (targetFrameworkName == null)
             {
-#if FEATURE_CORECLR
-                // if we don't have a value for targetFrameworkName we need to figure out if we should give the newest behavior or not.
-                if (CompatibilitySwitches.UseLatestBehaviorWhenTFMNotSpecified)
-                {
-                    fxId = TargetFrameworkId.NetFramework;
-                    fxVersion = 50000; // We are going to default to the latest value for version that we have in our code.
-                }
-                else
-#endif
-                    fxId = TargetFrameworkId.Unspecified;
+                fxId = TargetFrameworkId.Unspecified;
             }
             else if (!ParseTargetFrameworkMonikerIntoEnum(targetFrameworkName, out fxId, out fxVersion))
                 fxId = TargetFrameworkId.Unrecognized;