summaryrefslogtreecommitdiff
path: root/src/binder
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-03-21 09:06:54 -0700
committerJan Kotas <jkotas@microsoft.com>2016-03-22 11:33:44 -0700
commit3e537a4fbc5480280c990b51bd61e7a0c12df860 (patch)
tree93eaea5dee861a5135a84b2efae6e97e53f93fb1 /src/binder
parent54e298abc6d73dc80a9243ef091ac324e7665ff9 (diff)
downloadcoreclr-3e537a4fbc5480280c990b51bd61e7a0c12df860.tar.gz
coreclr-3e537a4fbc5480280c990b51bd61e7a0c12df860.tar.bz2
coreclr-3e537a4fbc5480280c990b51bd61e7a0c12df860.zip
Delete legacy netcf compat support (part 2)
Diffstat (limited to 'src/binder')
-rw-r--r--src/binder/CMakeLists.txt1
-rw-r--r--src/binder/assemblybinder.cpp101
-rw-r--r--src/binder/binder.targets1
-rw-r--r--src/binder/compatibility.cpp255
-rw-r--r--src/binder/inc/compatibility.hpp31
5 files changed, 24 insertions, 365 deletions
diff --git a/src/binder/CMakeLists.txt b/src/binder/CMakeLists.txt
index 7180623f00..84b35b9cbc 100644
--- a/src/binder/CMakeLists.txt
+++ b/src/binder/CMakeLists.txt
@@ -18,7 +18,6 @@ set(BINDER_COMMON_SOURCES
debuglog.cpp
bindinglog.cpp
cdebuglog.cpp
- compatibility.cpp
textualidentityparser.cpp
assemblyidentitycache.cpp
coreclrbindercommon.cpp
diff --git a/src/binder/assemblybinder.cpp b/src/binder/assemblybinder.cpp
index a4ad3c1798..55d0147b07 100644
--- a/src/binder/assemblybinder.cpp
+++ b/src/binder/assemblybinder.cpp
@@ -23,7 +23,6 @@
#ifdef FEATURE_VERSIONING_LOG
#include "bindinglog.hpp"
#endif // FEATURE_VERSIONING_LOG
-#include "compatibility.hpp"
#include "utils.hpp"
#include "variables.hpp"
#include "stringarraylist.h"
@@ -47,10 +46,6 @@
BOOL IsCompilationProcess();
-#ifdef FEATURE_LEGACYNETCF
-extern BOOL RuntimeIsLegacyNetCF(DWORD adid);
-#endif
-
#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
#include "clrprivbindercoreclr.h"
#include "clrprivbinderassemblyloadcontext.h"
@@ -92,11 +87,6 @@ namespace BINDER_SPACE
AssemblyVersion *pRequestedVersion = pRequestedName->GetVersion();
AssemblyVersion *pFoundVersion = pFoundName->GetVersion();
- bool fWindowsPhone7 = false;
-#ifdef FEATURE_LEGACYNETCF
- fWindowsPhone7 = RuntimeIsLegacyNetCF(pApplicationContext->GetAppDomainId()) == TRUE;
-#endif
-
//
// If the AssemblyRef has no version, we can treat it as requesting the most accommodating version (0.0.0.0). In
// that case, skip version checking and allow the bind.
@@ -105,41 +95,31 @@ namespace BINDER_SPACE
{
return hr;
}
-
//
- // Windows Phone 7 Quirk:
+ // This if condition is paired with the one above that checks for pRequestedName
+ // not having an assembly version. If we didn't exit in the above if condition,
+ // and satisfy this one's requirements, we're in a situation where the assembly
+ // Ref has a version, but the Def doesn't, which cannot succeed a bind
//
- // NetCF does not respect version numbers when binding unsigned assemblies. If you ask
- // for a version you can get any version back, including an unversioned assembly.
- //
- if (!fWindowsPhone7 || pRequestedName->IsStronglyNamed())
+ _ASSERTE(pRequestedName->HaveAssemblyVersion());
+ if (!pFoundName->HaveAssemblyVersion())
{
- //
- // This if condition is paired with the one above that checks for pRequestedName
- // not having an assembly version. If we didn't exit in the above if condition,
- // and satisfy this one's requirements, we're in a situation where the assembly
- // Ref has a version, but the Def doesn't, which cannot succeed a bind
- //
- _ASSERTE(pRequestedName->HaveAssemblyVersion());
- if (!pFoundName->HaveAssemblyVersion())
- {
- hr = FUSION_E_APP_DOMAIN_LOCKED;
- }
- else if (pRequestedVersion->IsEqualFeatureVersion(pFoundVersion))
- {
- // Now service version matters
- if (pRequestedVersion->IsLargerServiceVersion(pFoundVersion))
- {
- hr = FUSION_E_APP_DOMAIN_LOCKED;
- }
- }
- else if (pRequestedVersion->IsLargerFeatureVersion(pFoundVersion))
+ hr = FUSION_E_APP_DOMAIN_LOCKED;
+ }
+ else if (pRequestedVersion->IsEqualFeatureVersion(pFoundVersion))
+ {
+ // Now service version matters
+ if (pRequestedVersion->IsLargerServiceVersion(pFoundVersion))
{
hr = FUSION_E_APP_DOMAIN_LOCKED;
}
}
-
+ else if (pRequestedVersion->IsLargerFeatureVersion(pFoundVersion))
+ {
+ hr = FUSION_E_APP_DOMAIN_LOCKED;
+ }
+
if (pApplicationContext->IsTpaListProvided() && hr == FUSION_E_APP_DOMAIN_LOCKED)
{
// For our new binding models, use a more descriptive error code than APP_DOMAIN_LOCKED for bind
@@ -929,15 +909,10 @@ namespace BINDER_SPACE
HRESULT hr = S_OK;
BINDER_LOG_ENTER(W("AssemblyBinder::BindByName"));
PathString assemblyDisplayName;
- ReleaseHolder<AssemblyName> pRetargetedAssemblyName;
- BOOL fIsRetargeted = FALSE;
-
- // Apply retargeting
- IF_FAIL_GO(Compatibility::Retarget(pAssemblyName, &pRetargetedAssemblyName, &fIsRetargeted));
// Look for already cached binding failure (ignore PA, every PA will lock the context)
- pRetargetedAssemblyName->GetDisplayName(assemblyDisplayName,
- AssemblyName::INCLUDE_VERSION);
+ pAssemblyName->GetDisplayName(assemblyDisplayName,
+ AssemblyName::INCLUDE_VERSION);
hr = pApplicationContext->GetFailureCache()->Lookup(assemblyDisplayName);
if (FAILED(hr))
@@ -953,18 +928,18 @@ namespace BINDER_SPACE
else if (hr == S_FALSE)
{
// workaround: Special case for byte arrays. Rerun the bind to create binding log.
- pRetargetedAssemblyName->SetIsDefinition(TRUE);
+ pAssemblyName->SetIsDefinition(TRUE);
hr = S_OK;
}
- if (!Assembly::IsValidArchitecture(pRetargetedAssemblyName->GetArchitecture()))
+ if (!Assembly::IsValidArchitecture(pAssemblyName->GetArchitecture()))
{
// Assembly reference contains wrong architecture
IF_FAIL_GO(FUSION_E_INVALID_NAME);
}
IF_FAIL_GO(BindLocked(pApplicationContext,
- pRetargetedAssemblyName,
+ pAssemblyName,
dwBindFlags,
excludeAppPaths,
pBindResult));
@@ -1014,8 +989,6 @@ namespace BINDER_SPACE
BINDER_LOG_ENTER(W("AssemblyBinder::BindWhereRef"));
ReleaseHolder<Assembly> pAssembly;
- ReleaseHolder<AssemblyName> pRetargetedAssemblyName;
- BOOL fIsRetargeted = FALSE;
BindResult lockedBindResult;
// Look for already cached binding failure
@@ -1045,12 +1018,10 @@ namespace BINDER_SPACE
AssemblyName *pAssemblyName;
pAssemblyName = pAssembly->GetAssemblyName();
- IF_FAIL_GO(Compatibility::Retarget(pAssemblyName, &pRetargetedAssemblyName, &fIsRetargeted));
-
if (!fNgenExplicitBind)
{
IF_FAIL_GO(BindLockedOrService(pApplicationContext,
- pRetargetedAssemblyName,
+ pAssemblyName,
excludeAppPaths,
&lockedBindResult));
if (lockedBindResult.HaveResult())
@@ -1058,21 +1029,6 @@ namespace BINDER_SPACE
pBindResult->SetResult(&lockedBindResult);
GO_WITH_HRESULT(S_OK);
}
-
- else if (fIsRetargeted)
- {
- // We did not find retargeted assembly.
- // Check that assembly we have does match (must have retargetable property set).
- ReleaseHolder<AssemblyName> pClonedAssemblyName;
-
- IF_FAIL_GO(pRetargetedAssemblyName->Clone(&pClonedAssemblyName));
- pClonedAssemblyName->SetIsRetargetable(TRUE);
-
- if (!pClonedAssemblyName->Equals(pAssemblyName, AssemblyName::INCLUDE_VERSION))
- {
- IF_FAIL_GO(FUSION_E_REF_DEF_MISMATCH);
- }
- }
}
hr = S_OK;
@@ -1241,17 +1197,8 @@ namespace BINDER_SPACE
{
DWORD dwIncludeFlags = AssemblyName::INCLUDE_DEFAULT;
- bool fWindowsPhone7 = false;
-#ifdef FEATURE_LEGACYNETCF
- fWindowsPhone7 = RuntimeIsLegacyNetCF(pApplicationContext->GetAppDomainId()) == TRUE;
-#endif
-
- if (!tpaListAssembly || (fWindowsPhone7 && tpaListAssembly))
+ if (!tpaListAssembly)
{
- //
- // On Windows Phone 7, exclude culture comparisons when requesting an uncultured
- // assembly for app compat reasons (there are main app assemblies with spurious cultures)
- //
SString &culture = pRequestedAssemblyName->GetCulture();
if (culture.IsEmpty() || culture.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral))
{
diff --git a/src/binder/binder.targets b/src/binder/binder.targets
index fc214c9ecb..01b35e2315 100644
--- a/src/binder/binder.targets
+++ b/src/binder/binder.targets
@@ -40,7 +40,6 @@
<CppCompile Include="..\DebugLog.cpp" />
<CppCompile Include="..\BindingLog.cpp" />
<CppCompile Include="..\CDebugLog.cpp" />
- <CppCompile Include="..\Compatibility.cpp" />
<CppCompile Include="..\TextualIdentityParser.cpp" />
<CppCompile Include="..\AssemblyIdentityCache.cpp" />
<CppCompile Include="..\CLRPrivBinderAssemblyLoadContext.cpp" Condition="'$(FeatureHostAssemblyResolver)' == 'true'"/>
diff --git a/src/binder/compatibility.cpp b/src/binder/compatibility.cpp
deleted file mode 100644
index ca376b63c8..0000000000
--- a/src/binder/compatibility.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// ============================================================
-//
-// Compatibility.cpp
-//
-
-
-//
-// Implements the V2 Compatibility class
-//
-// ============================================================
-
-#include "compatibility.hpp"
-#include "assemblyname.hpp"
-#include "utils.hpp"
-#include "ndpversion.h"
-
-#define ECMAKeyToken W("B77A5C561934E089") // The ECMA key used by some framework assemblies: mscorlib, system, etc.
-#define FXKeyToken W("b03f5f7f11d50a3a") // The FX key used by other framework assemblies: System.Web, System.Drawing, etc.
-#define CoreClrKeyToken W("7CEC85D7BEA7798E") // The silverlight platform key used by CoreClr framework assemblies: mscorlib, system, etc
-#define SilverlightKeyToken W("31bf3856ad364e35")
-
-#define NETCF_PUBLIC_KEY_TOKEN_3 W("969db8053d3322ac")
-
-#ifdef FEATURE_LEGACYNETCF
-extern BOOL RuntimeIsLegacyNetCF(DWORD adid);
-#endif
-
-namespace BINDER_SPACE
-{
- typedef struct
- {
- LPCWSTR pwzSimpleName;
- LPCWSTR pwzPublicKeyToken;
- LPCWSTR pwzVersion;
- // Newline
- LPCWSTR pwzNewSimpleName;
- LPCWSTR pwzNewPublicKeyToken;
- LPCWSTR pwzNewVersion;
-#ifdef FEATURE_LEGACYNETCF
- BOOL fMangoOnly;
-#endif
- } RetargetConfig;
-
- namespace
- {
- // Hard-coded retargeting table from legacy Fusion
-
- static RetargetConfig arRetargetConfig[] =
- {
- // Example entry
- // {W("System.Data.SqlServerCe"), SQL_MOBILE_PUBLIC_KEY_TOKEN, W("3.0.3600.0"),
- // NULL, SQL_PUBLIC_KEY_TOKEN, VER_SQL_ASSEMBLYVERSION_STR_L}
- {W("Microsoft.CSharp"), SilverlightKeyToken, W("1.0.0.0-99.0.0.0"),
- NULL, FXKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- , FALSE
-#endif
- },
- {W("System.Xml"), NETCF_PUBLIC_KEY_TOKEN_3, W("1.0.0.0-99.0.0.0"),
- NULL, CoreClrKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- ,TRUE
-#endif
- },
- {W("System"), NETCF_PUBLIC_KEY_TOKEN_3, W("1.0.0.0-99.0.0.0"),
- NULL, CoreClrKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- , TRUE
-#endif
- },
- {W("Microsoft.VisualBasic"), NETCF_PUBLIC_KEY_TOKEN_3, W("1.0.0.0-99.0.0.0"),
- NULL, CoreClrKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- , TRUE
-#endif
- },
- {W("System.Core"), NETCF_PUBLIC_KEY_TOKEN_3, W("1.0.0.0-99.0.0.0"),
- NULL, CoreClrKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- , TRUE
-#endif
- },
- {W("System.Runtime.Serialization"), NETCF_PUBLIC_KEY_TOKEN_3, W("1.0.0.0-99.0.0.0"),
- NULL, CoreClrKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- , TRUE
-#endif
- },
- {W("System.ServiceModel"), NETCF_PUBLIC_KEY_TOKEN_3, W("1.0.0.0-99.0.0.0"),
- NULL, CoreClrKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- , TRUE
-#endif
- },
- {W("System.ServiceModel.Web"), NETCF_PUBLIC_KEY_TOKEN_3, W("1.0.0.0-99.0.0.0"),
- NULL, CoreClrKeyToken, VER_ASSEMBLYVERSION_STR_L
-#ifdef FEATURE_LEGACYNETCF
- , TRUE
-#endif
- }
- };
-
-
- BOOL IsMatchingString(/* in */ SString &sValue,
- /* in */ LPCWSTR pwzValue)
- {
- SString value(SString::Literal, pwzValue);
-
- return EqualsCaseInsensitive(sValue, value);
- }
-
- BOOL IsMatchingVersion(/* in */ AssemblyVersion *pAssemblyVersion,
- /* in */ LPCWSTR pwzAssemblyVersion)
- {
- SmallStackSString assemblyVersionStr(pwzAssemblyVersion);
- assemblyVersionStr.Normalize();
- SString::CIterator pos = assemblyVersionStr.Begin();
-
- if (assemblyVersionStr.Find(pos, W('-')))
- {
- SmallStackSString beginVersionStr(assemblyVersionStr,
- assemblyVersionStr.Begin(),
- pos++);
- SmallStackSString endVersionStr(assemblyVersionStr, pos, assemblyVersionStr.End());
-
- BINDER_LOG_STRING(W("begin"), beginVersionStr);
- BINDER_LOG_STRING(W("end"), endVersionStr);
-
- AssemblyVersion beginVersion;
- AssemblyVersion endVersion;
- BOOL fIsValidBeginVersion = beginVersion.SetVersion(beginVersionStr.GetUnicode());
- BOOL fIsValidEndVersion = endVersion.SetVersion(endVersionStr.GetUnicode());
- _ASSERTE(fIsValidBeginVersion && fIsValidEndVersion);
-
- return (pAssemblyVersion->IsLargerOrEqual(&beginVersion) &&
- pAssemblyVersion->IsSmallerOrEqual(&endVersion));
- }
- else
- {
- AssemblyVersion assemblyVersion;
- BOOL fIsValidVersion = assemblyVersion.SetVersion(pwzAssemblyVersion);
- _ASSERTE(fIsValidVersion);
-
- return pAssemblyVersion->Equals(&assemblyVersion);
- }
- }
- };
-
-
- /* static */
- HRESULT Compatibility::Retarget(AssemblyName *pAssemblyName,
- AssemblyName **ppRetargetedAssemblyName,
- BOOL *pfIsRetargeted)
- {
- HRESULT hr = S_OK;
- BINDER_LOG_ENTER(W("Compatibility::Retarget"));
-
- IF_FALSE_GO(pAssemblyName != NULL);
- IF_FALSE_GO(ppRetargetedAssemblyName != NULL);
-
- BINDER_LOG_ASSEMBLY_NAME(W("source"), pAssemblyName);
-
- if (pfIsRetargeted)
- {
- *pfIsRetargeted = FALSE;
- }
-#ifdef FEATURE_CORESYSTEM
- // Apply retargeting only for strong-named culture neutral assemblies
- if (pAssemblyName->IsStronglyNamed() &&
- pAssemblyName->GetDeNormalizedCulture().IsEmpty())
- {
- ReleaseHolder<AssemblyName> pRetargetedAssemblyName;
- SString &simpleName = pAssemblyName->GetSimpleName();
- AssemblyVersion *pAssemblyVersion = pAssemblyName->GetVersion();
- SString publicKeyToken;
-
- TextualIdentityParser::BlobToHex(pAssemblyName->GetPublicKeyTokenBLOB(),
- publicKeyToken);
-
- // Perform linear search for matching assembly. Legacy Fusion also does that
- for (unsigned int i = 0; i < LENGTH_OF(arRetargetConfig); i++)
- {
-#ifdef FEATURE_LEGACYNETCF
- if (!RuntimeIsLegacyNetCF(0) && arRetargetConfig[i].fMangoOnly == TRUE)
- continue;
-#endif
- if (IsMatchingString(simpleName, arRetargetConfig[i].pwzSimpleName) &&
- IsMatchingVersion(pAssemblyVersion, arRetargetConfig[i].pwzVersion) &&
- IsMatchingString(publicKeyToken, arRetargetConfig[i].pwzPublicKeyToken))
- {
- AssemblyVersion newAssemblyVersion;
- IF_FALSE_GO(newAssemblyVersion.SetVersion(arRetargetConfig[i].pwzNewVersion));
-
- SAFE_NEW(pRetargetedAssemblyName, AssemblyName);
-
- if (arRetargetConfig[i].pwzNewSimpleName != NULL)
- {
- pRetargetedAssemblyName->
- GetSimpleName().Set(arRetargetConfig[i].pwzNewSimpleName);
- }
- else
- {
- pRetargetedAssemblyName->GetSimpleName().Set(simpleName);
- }
- pRetargetedAssemblyName->SetVersion(&newAssemblyVersion);
-
- SBuffer newPublicKeyTokenBlob;
- SmallStackSString newPublicKeyToken(arRetargetConfig[i].pwzNewPublicKeyToken);
- TextualIdentityParser::HexToBlob(newPublicKeyToken,
- FALSE /* fValidateHex */,
- TRUE /* fIsToken */,
- newPublicKeyTokenBlob);
-
- pRetargetedAssemblyName->GetPublicKeyTokenBLOB().Set(newPublicKeyTokenBlob);
-
- BINDER_LOG_ASSEMBLY_NAME(W("retargeted"), pRetargetedAssemblyName);
-
- *ppRetargetedAssemblyName = pRetargetedAssemblyName.Extract();
-
- if (pfIsRetargeted)
- {
- *pfIsRetargeted = TRUE;
- }
-
- GO_WITH_HRESULT(S_OK);
- }
- }
-
- // Create a clone without retargetable flag
- if (pAssemblyName->GetIsRetargetable())
- {
- IF_FAIL_GO(pAssemblyName->Clone(&pRetargetedAssemblyName));
- pRetargetedAssemblyName->SetIsRetargetable(FALSE);
- *ppRetargetedAssemblyName = pRetargetedAssemblyName.Extract();
- } else
- {
- pAssemblyName->AddRef();
- *ppRetargetedAssemblyName = pAssemblyName;
- }
- }
- else
-#endif // FEATURE_CORESYSTEM
- {
- pAssemblyName->AddRef();
- *ppRetargetedAssemblyName = pAssemblyName;
- }
-
- Exit:
- BINDER_LOG_LEAVE_HR(W("Compatibility::Retarget"), hr);
- return hr;
- }
-};
diff --git a/src/binder/inc/compatibility.hpp b/src/binder/inc/compatibility.hpp
deleted file mode 100644
index 80ee20657b..0000000000
--- a/src/binder/inc/compatibility.hpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-// ============================================================
-//
-// Compatibility.hpp
-//
-
-
-//
-// Defines the V2 Compatibility class
-//
-// ============================================================
-
-#ifndef __BINDER__COMPATIBLITY_HPP__
-#define __BINDER__COMPATIBLITY_HPP__
-
-#include "bindertypes.hpp"
-
-namespace BINDER_SPACE
-{
- class Compatibility
- {
- public:
- static HRESULT Retarget(/* in */ AssemblyName *pAssemblyName,
- /* out */ AssemblyName **ppRetargetedAssemblyName,
- /* out */ BOOL *pFIsRetargeted);
- };
-};
-
-#endif