From c926ae44b0767103a8892145c96e5107e0aa9e49 Mon Sep 17 00:00:00 2001 From: AlexGhiondea Date: Wed, 19 Oct 2016 13:24:40 -0700 Subject: [PATCH] Remove the UseLatestBehaviorWhenTFMNotSpecified compat switch (dotnet/coreclr#5708) * 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/hosts/coreconsole/coreconsole.cpp | 3 --- src/coreclr/src/coreclr/hosts/corerun/corerun.cpp | 3 --- .../hosts/unixcoreruncommon/coreruncommon.cpp | 3 --- .../src/mscorlib/src/System/CompatibilitySwitches.cs | 20 ++------------------ .../System/Runtime/Versioning/BinaryCompatibility.cs | 11 +---------- 5 files changed, 3 insertions(+), 37 deletions(-) diff --git a/src/coreclr/src/coreclr/hosts/coreconsole/coreconsole.cpp b/src/coreclr/src/coreclr/hosts/coreconsole/coreconsole.cpp index 1533dff..2af9115 100644 --- a/src/coreclr/src/coreclr/hosts/coreconsole/coreconsole.cpp +++ b/src/coreclr/src/coreclr/hosts/coreconsole/coreconsole.cpp @@ -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") }; diff --git a/src/coreclr/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/src/coreclr/hosts/corerun/corerun.cpp index e7ddab2..0df2806 100644 --- a/src/coreclr/src/coreclr/hosts/corerun/corerun.cpp +++ b/src/coreclr/src/coreclr/hosts/corerun/corerun.cpp @@ -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 }; diff --git a/src/coreclr/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp b/src/coreclr/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp index b3a0c07..d7186d7 100644 --- a/src/coreclr/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp +++ b/src/coreclr/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp @@ -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, }; diff --git a/src/coreclr/src/mscorlib/src/System/CompatibilitySwitches.cs b/src/coreclr/src/mscorlib/src/System/CompatibilitySwitches.cs index 7facf85..893a47e 100644 --- a/src/coreclr/src/mscorlib/src/System/CompatibilitySwitches.cs +++ b/src/coreclr/src/mscorlib/src/System/CompatibilitySwitches.cs @@ -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 - /// - /// This property returns whether to give the latest behavior when the TFM is missing - /// - 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 { diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs index 99e30b5..e8c9c7d 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs @@ -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; -- 2.7.4