From 56d4ba8a9338c3ff7378d18378f38ad847f130f2 Mon Sep 17 00:00:00 2001 From: danmosemsft Date: Sat, 11 Feb 2017 07:20:12 -0800 Subject: Revert "Remove always defined FEATURE_CORESYSTEM" This reverts commit 751771a8976f909af772e35c167bd7e3ffbe44c8. --- src/vm/domainfile.cpp | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) (limited to 'src/vm/domainfile.cpp') diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index e66ebaef8b..bf7fc57774 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -3373,7 +3373,113 @@ bool DomainAssembly::GetDebuggingOverrides(DWORD *pdwFlags) } CONTRACTL_END; +#if defined(DEBUGGING_SUPPORTED) && !defined(FEATURE_CORESYSTEM) + // TODO FIX in V5.0 + // Any touch of the file system is relatively expensive even in the warm case. + // + // Ideally we remove the .INI feature completely (if we need something put it in the .exe.config file) + // + // However because of compatibility concerns, we won't do this until the next side-by-side release + // In the mean time don't check in the case where we have already loaded the NGEN image, as the + // JIT overrides don't mean anything in that case as we won't be jitting anyway. + // This avoids doing these probes for framework DLLs right away. + if (GetFile()->HasNativeImage()) + return false; + + _ASSERTE(pdwFlags); + + bool fHasBits = false; + WCHAR *pFileName = NULL; + HRESULT hr = S_OK; + UINT cbExtOrValue = 4; + WCHAR *pTail = NULL; + size_t len = 0; + WCHAR *lpFileName = NULL; + + const WCHAR *wszFileName = GetFile()->GetPath(); + + if (wszFileName == NULL) + { + return false; + } + + // lpFileName is a copy of the original, and will be edited. + CQuickBytes qb; + len = wcslen(wszFileName); + size_t cchlpFileName = (len + 1); + lpFileName = (WCHAR*)qb.AllocThrows(cchlpFileName * sizeof(WCHAR)); + wcscpy_s(lpFileName, cchlpFileName, wszFileName); + + pFileName = wcsrchr(lpFileName, W('\\')); + + if (pFileName == NULL) + { + pFileName = lpFileName; + } + + if (*pFileName == W('\\')) + { + pFileName++; //move the pointer past the last '\' + } + + _ASSERTE(wcslen(W(".INI")) == cbExtOrValue); + + if (pFileName == NULL || (pTail=wcsrchr(pFileName, W('.'))) == NULL || (wcslen(pTail)