Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit ed0e579

Browse files
author
John Chen
committed
Fix a CrossGen CreatePDB issue that caused a Windows build break
CrossGen /CreatePDB command gives preference to the TPA list while loading assemblies. So if the TPA contains the IL version of the input assembly but not the NI version, we would end up loading the IL instead of NI. This causes the CreatePDB command to fail, since it can't operate on IL images. This is fixed by putting the input file as the first entry in the TPA list. Another issue is when the above error does occur, the error message is very unclear (it only shows "Unspecified error"). This is fixed with a better error message. [tfs-changeset: 1587876]
1 parent 88c4927 commit ed0e579

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/tools/crossgen/crossgen.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,14 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
850850

851851
#ifdef FEATURE_CORECLR
852852
SString ssTPAList;
853+
854+
if (fCreatePDB)
855+
{
856+
// While creating PDB, assembly binder gives preference to files in TPA.
857+
// This can create difficulties if the input file is not in TPA.
858+
// To avoid this issue, put the input file as the first item in TPA.
859+
ssTPAList.Append(pwzFilename);
860+
}
853861

854862
// Are we compiling mscorlib.dll?
855863
bool fCompilingMscorlib = StringEndsWith((LPWSTR)pwzFilename, W("mscorlib.dll"));

src/vm/compile.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4812,8 +4812,10 @@ HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImage
48124812
if (!fAtLeastOneNativeModuleFound)
48134813
{
48144814
GetSvcLogger()->Printf(
4815+
W("Loaded image '%s' (for input file '%s') is not a native image.\n"),
4816+
pAssembly->GetManifestFile()->GetPath().GetUnicode(),
48154817
pNativeImagePath);
4816-
return E_FAIL;
4818+
return CORDBG_E_NO_IMAGE_AVAILABLE;
48174819
}
48184820

48194821
GetSvcLogger()->Printf(

0 commit comments

Comments
 (0)