WinMD Adapter should only lookup mscorlib in WinMD references
authorGaurav Khanna <gkhanna@microsoft.com>
Wed, 25 May 2016 22:42:20 +0000 (15:42 -0700)
committerGaurav Khanna <gkhanna@microsoft.com>
Wed, 25 May 2016 22:42:20 +0000 (15:42 -0700)
src/inc/utilcode.h
src/md/winmd/adapter.cpp

index ebc0514..aa8cb01 100644 (file)
@@ -62,6 +62,7 @@ const WCHAR kWatsonName2[] = W("drwtsn32");
 #define CoreLibNameLen 22
 #define CoreLibSatelliteName_A "System.Private.CoreLib.resources"
 #define CoreLibSatelliteNameLen 32
+#define LegacyCoreLibName_A "mscorlib"
 #else // !defined(FEATURE_CORECLR)
 #define CoreLibName_W W("mscorlib")
 #define CoreLibName_IL_W W("mscorlib.dll")
@@ -74,6 +75,7 @@ const WCHAR kWatsonName2[] = W("drwtsn32");
 #define CoreLibNameLen 8
 #define CoreLibSatelliteName_A "mscorlib.resources"
 #define CoreLibSatelliteNameLen 18
+#define LegacyCoreLibName_A "mscorlib"
 #endif // defined(FEATURE_CORECLR)
 
 class StringArrayList;
index 146b04e..5b4d95c 100644 (file)
@@ -157,7 +157,9 @@ HRESULT CheckIfWinMDAdapterNeeded(IMDCommon *pRawMDCommon)
         LPCSTR arefName;
         USHORT usMajorVersion;
         IfFailGo(pNewAdapter->m_pRawMetaModelCommonRO->CommonGetAssemblyRefProps(mdar, &usMajorVersion, NULL, NULL, NULL, NULL, NULL, NULL, &arefName, NULL, NULL, NULL));
-        if (0 == strcmp(arefName, CoreLibName_A))
+        
+        // We check for legacy Core library name since Windows.winmd references mscorlib and not System.Private.CoreLib
+        if (0 == strcmp(arefName, LegacyCoreLibName_A))
         {
             pNewAdapter->m_assemblyRefMscorlib = mdar;