From 10b964f1beab13479c223f594cdd55a6e583eb3e Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Fri, 23 Sep 2016 17:39:43 -0700 Subject: Remove CoreCLR's dependency on the diasymreader.dll installed as part of the full .NET Framework on Desktop (#7336) * Remove CoreCLR's dependency on the diasymreader.dll installed as part of the full .NET Framework on Desktop Issue #5922 * Code review feedback. --- src/vm/compile.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src/vm/compile.cpp') diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index 4aefe2f4e9..50a2412904 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -2909,36 +2909,44 @@ public: { LIMITED_METHOD_CONTRACT; } - + +#ifdef FEATURE_CORECLR +#define WRITER_LOAD_ERROR_MESSAGE W("Unable to load ") NATIVE_SYMBOL_READER_DLL W(". Please ensure that ") NATIVE_SYMBOL_READER_DLL W(" is on the path. Error='%d'\n") +#else +#define WRITER_LOAD_ERROR_MESSAGE W("Unable to load diasymreader.dll. Please ensure that version 11 or greater of diasymreader.dll is on the path. You can typically find this DLL in the desktop .NET install directory for 4.5 or greater. Error='%d'\n") +#endif + HRESULT Load(LPCWSTR wszDiasymreaderPath = nullptr) { STANDARD_VM_CONTRACT; HRESULT hr = S_OK; - m_hModule = WszLoadLibrary(wszDiasymreaderPath != nullptr ? wszDiasymreaderPath : W("diasymreader.dll")); + m_hModule = WszLoadLibrary(wszDiasymreaderPath != nullptr ? wszDiasymreaderPath : (LPCWSTR)NATIVE_SYMBOL_READER_DLL); if (m_hModule == NULL) { - GetSvcLogger()->Printf( - W("Unable to load diasymreader.dll. Please ensure that version 11 or greater of diasymreader.dll is on the path. You can typically find this DLL in the desktop .NET install directory for 4.5 or greater. Error='%d'\n"), - GetLastError()); - return HRESULT_FROM_WIN32(GetLastError()); + hr = HRESULT_FROM_WIN32(GetLastError()); + GetSvcLogger()->Printf(WRITER_LOAD_ERROR_MESSAGE, GetLastError()); + return hr; } m_Create = reinterpret_cast(GetProcAddress(m_hModule, "CreateNGenPdbWriter")); if (m_Create == NULL) { - GetSvcLogger()->Printf( - W("An incorrect version of diasymreader.dll was found. Please ensure that version 11 or greater of diasymreader.dll is on the path. You can typically find this DLL in the desktop .NET install directory for 4.5 or greater. Error='%d'\n"), - GetLastError()); - return HRESULT_FROM_WIN32(GetLastError()); + hr = HRESULT_FROM_WIN32(GetLastError()); + GetSvcLogger()->Printf(WRITER_LOAD_ERROR_MESSAGE, GetLastError()); + return hr; } if ((m_dwExtraData & kPDBLines) != 0) { hr = FakeCoCreateInstanceEx( CLSID_CorSymBinder_SxS, - NULL, +#ifdef FEATURE_CORECLR + wszDiasymreaderPath != nullptr ? wszDiasymreaderPath : (LPCWSTR)NATIVE_SYMBOL_READER_DLL, +#else + wszDiasymreaderPath, +#endif IID_ISymUnmanagedBinder, (void**)&m_pBinder, NULL); -- cgit v1.2.3