Skip to content
Permalink
Browse files

Remove CoreCLR's dependency on the diasymreader.dll installed as part…

… of the full .NET Framework on Desktop (#7342)

Issue #5922
  • Loading branch information
mikem8361 committed Sep 27, 2016
1 parent c570c06 commit 098eb21dc553e32da7e22d9a73be1750d011fe82
Showing with 38 additions and 12 deletions.
  1. +4 −0 src/vm/ceeload.cpp
  2. +15 −1 src/vm/ceeload.h
  3. +19 −11 src/vm/compile.cpp
@@ -4280,7 +4280,11 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void)
// On desktop, the framework installer is supposed to install diasymreader.dll as well
// and so this shouldn't happen.
hr = FakeCoCreateInstanceEx(CLSID_CorSymBinder_SxS,
#ifdef FEATURE_CORECLR
NATIVE_SYMBOL_READER_DLL,
#else
GetInternalSystemDirectory(),
#endif
IID_ISymUnmanagedBinder,
(void**)&pBinder,
NULL);
@@ -93,7 +93,21 @@ class PersistentInlineTrackingMap;
#define PARAMMETHODS_HASH_BUCKETS 11
#define METHOD_STUBS_HASH_BUCKETS 11
#define GUID_TO_TYPE_HASH_BUCKETS 16


// The native symbol reader dll name
#ifdef FEATURE_CORECLR
#if defined(_TARGET_AMD64_)
#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.amd64.dll")
#elif defined(_TARGET_X86_)
#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.x86.dll")
#elif defined(_TARGET_ARM_)
#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.arm.dll")
#elif defined(_TARGET_ARM64_)
#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.arm64.dll")
#endif
#else
#define NATIVE_SYMBOL_READER_DLL W("diasymreader.dll")
#endif

typedef DPTR(PersistentInlineTrackingMap) PTR_PersistentInlineTrackingMap;

@@ -2919,36 +2919,44 @@ class NGenPdbWriter
{
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<CreateNGenPdbWriter_t>(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);

0 comments on commit 098eb21

Please sign in to comment.
You can’t perform that action at this time.