diff options
author | John Chen <jochen@microsoft.com> | 2016-09-21 06:50:03 -0700 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-09-21 06:50:03 -0700 |
commit | 96f474c67e83b178c3a27afc1540953948610c73 (patch) | |
tree | 0220366a075591eb136b6986c53632fb47188ff3 | |
parent | eb98e3dd66f374be44f523099084e45163de5143 (diff) | |
download | coreclr-96f474c67e83b178c3a27afc1540953948610c73.tar.gz coreclr-96f474c67e83b178c3a27afc1540953948610c73.tar.bz2 coreclr-96f474c67e83b178c3a27afc1540953948610c73.zip |
Fix CrossGen error reporting when input is missing (#7287)
Currently, running "crossgen foo.dll" when foo.dll does not exist produces
a misleading error message "The image being compiled is not a .NET assembly".
The reason is CrossGen ignores the actual error code reported during
initial asssembly load and verification, and always reports the error as
NGEN_E_FILE_NOT_ASSEMBLY. This change removes that logic, since the original
error code is much more likely to be useful.
-rw-r--r-- | src/vm/compile.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index 4e39909735..4aefe2f4e9 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -382,7 +382,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( Assembly * pAssembly; HRESULT hrProcessLibraryBitnessMismatch = S_OK; - bool verifyingImageIsAssembly = false; // We don't want to do a LoadFrom, since they do not work with ngen. Instead, // read the metadata from the file and do a bind based on that. @@ -416,9 +415,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( fExplicitBindToNativeImage ? MDInternalImport_NoCache : MDInternalImport_Default); } -#if defined(FEATURE_WINDOWSPHONE) - verifyingImageIsAssembly = true; -#endif // FEATURE_WINDOWSPHONE if (fExplicitBindToNativeImage && !pImage->HasReadyToRunHeader()) { pImage->VerifyIsNIAssembly(); @@ -427,8 +423,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( { pImage->VerifyIsAssembly(); } - - verifyingImageIsAssembly = false; // Check to make sure the bitness of the assembly matches the bitness of the process // we will be loading it into and store the result. If a COR_IMAGE_ERROR gets thrown @@ -552,11 +546,7 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( } EX_CATCH_HRESULT(hr); - if (verifyingImageIsAssembly && hr != S_OK) - { - hr = NGEN_E_FILE_NOT_ASSEMBLY; - } - else if ( hrProcessLibraryBitnessMismatch != S_OK && ( hr == COR_E_BADIMAGEFORMAT || hr == HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT) ) ) + if ( hrProcessLibraryBitnessMismatch != S_OK && ( hr == COR_E_BADIMAGEFORMAT || hr == HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT) ) ) { hr = hrProcessLibraryBitnessMismatch; } |