From f29eee4896d490f88e06865916d5821d0fad935a Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Tue, 20 Sep 2016 15:22:33 -0700 Subject: [PATCH] Fix launch timing issue in dbgshim found in VS. (#7279) Issue #7274. --- src/dlls/dbgshim/dbgshim.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dlls/dbgshim/dbgshim.cpp b/src/dlls/dbgshim/dbgshim.cpp index 3c4e951..4d6dc5a 100644 --- a/src/dlls/dbgshim/dbgshim.cpp +++ b/src/dlls/dbgshim/dbgshim.cpp @@ -392,7 +392,7 @@ public: int numTries = 0; HRESULT hr; - while (numTries < 10) + while (numTries < 25) { // EnumerateCLRs uses the OS API CreateToolhelp32Snapshot which can return ERROR_BAD_LENGTH or // ERROR_PARTIAL_COPY. If we get either of those, we try wait 1/10th of a second try again (that @@ -517,7 +517,9 @@ public: bool coreclrExists = false; HRESULT hr = InvokeStartupCallback(&coreclrExists); - if (SUCCEEDED(hr)) + // Because the target process is suspended on create, the toolhelp apis fail with the below errors even + // with the retry logic in InternalEnumerateCLRs. + if (SUCCEEDED(hr) || (hr == HRESULT_FROM_WIN32(ERROR_PARTIAL_COPY)) || (hr == HRESULT_FROM_WIN32(ERROR_BAD_LENGTH))) { if (!coreclrExists && !m_canceled) { -- 2.7.4