From 04d548568845f37bfafdbb7a10445db80a8a3f9a Mon Sep 17 00:00:00 2001 From: Artem Lysenko Date: Wed, 8 Jul 2026 17:00:31 +0200 Subject: [PATCH 1/2] Test: retry MddBootstrapInitialize on transient State Repository dependency error (AB#62489699) The Test_x86_Windows.10.Professional.22H2_releasex86 stage in the Foundation PR pipeline intermittently fails in TAEF ClassSetup with MddBootstrapInitialize returning STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED (0x80670016). On slow/loaded agents the State Repository can still be indexing the just-installed DDLM package when the bootstrapper enumerates it; the same SHA passes on retry, confirming a transient race rather than a product regression. SetupBootstrapWithVersion now retries MddBootstrapInitialize with a bounded backoff (up to 10 attempts, 300ms apart) only when it returns 0x80670016. Any other HRESULT is verified immediately and is not masked. --- test/inc/WindowsAppRuntime.Test.Bootstrap.h | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/inc/WindowsAppRuntime.Test.Bootstrap.h b/test/inc/WindowsAppRuntime.Test.Bootstrap.h index a94dac4f07..18f34e6a8b 100644 --- a/test/inc/WindowsAppRuntime.Test.Bootstrap.h +++ b/test/inc/WindowsAppRuntime.Test.Bootstrap.h @@ -130,7 +130,29 @@ namespace Test::Bootstrap TP::WindowsAppRuntimeMain::c_PackageNamePrefix)); } - VERIFY_SUCCEEDED(MddBootstrapInitialize(version_MajorMinor, nullptr, minVersion)); + // AB#62489699: On slow/loaded test agents (observed on the x86 Win10 22H2 stage) the State + // Repository can still be indexing the DDLM package we just installed when the bootstrapper + // enumerates it, so MddBootstrapInitialize fails with STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED + // (0x80670016). This is transient and clears once indexing completes, so retry with a bounded + // backoff. Only this specific HRESULT is retried; any other failure is verified immediately and + // is not masked. + constexpr HRESULT c_stateRepositoryDependencyNotResolved{ static_cast(0x80670016) }; // STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED + constexpr UINT32 c_maxInitRetries{ 10 }; + constexpr DWORD c_initRetryDelayMs{ 300 }; + HRESULT initHR{ E_FAIL }; + for (UINT32 retry = 0; ; ++retry) + { + initHR = MddBootstrapInitialize(version_MajorMinor, nullptr, minVersion); + if (SUCCEEDED(initHR) || (initHR != c_stateRepositoryDependencyNotResolved) || (retry >= c_maxInitRetries)) + { + break; + } + WEX::Logging::Log::Comment(WEX::Common::String().Format( + L"MddBootstrapInitialize returned STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED (0x%X); State Repository likely still indexing the just-installed package. Retry %u/%u after %ums.", + initHR, retry + 1, c_maxInitRetries, c_initRetryDelayMs)); + Sleep(c_initRetryDelayMs); + } + VERIFY_SUCCEEDED(initHR); s_bootstrapDll = std::move(bootstrapDll); } From 5a20ec2e54d15d3d52ddc2034c96c8fad1695604 Mon Sep 17 00:00:00 2001 From: Artem Lysenko Date: Wed, 8 Jul 2026 17:08:32 +0200 Subject: [PATCH 2/2] Test: make bootstrap init retry bound total attempts (10) to match description (AB#62489699) --- test/inc/WindowsAppRuntime.Test.Bootstrap.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/inc/WindowsAppRuntime.Test.Bootstrap.h b/test/inc/WindowsAppRuntime.Test.Bootstrap.h index 18f34e6a8b..42cc352288 100644 --- a/test/inc/WindowsAppRuntime.Test.Bootstrap.h +++ b/test/inc/WindowsAppRuntime.Test.Bootstrap.h @@ -137,19 +137,19 @@ namespace Test::Bootstrap // backoff. Only this specific HRESULT is retried; any other failure is verified immediately and // is not masked. constexpr HRESULT c_stateRepositoryDependencyNotResolved{ static_cast(0x80670016) }; // STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED - constexpr UINT32 c_maxInitRetries{ 10 }; + constexpr UINT32 c_maxInitAttempts{ 10 }; constexpr DWORD c_initRetryDelayMs{ 300 }; HRESULT initHR{ E_FAIL }; - for (UINT32 retry = 0; ; ++retry) + for (UINT32 attempt = 1; attempt <= c_maxInitAttempts; ++attempt) { initHR = MddBootstrapInitialize(version_MajorMinor, nullptr, minVersion); - if (SUCCEEDED(initHR) || (initHR != c_stateRepositoryDependencyNotResolved) || (retry >= c_maxInitRetries)) + if (SUCCEEDED(initHR) || (initHR != c_stateRepositoryDependencyNotResolved) || (attempt == c_maxInitAttempts)) { break; } WEX::Logging::Log::Comment(WEX::Common::String().Format( - L"MddBootstrapInitialize returned STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED (0x%X); State Repository likely still indexing the just-installed package. Retry %u/%u after %ums.", - initHR, retry + 1, c_maxInitRetries, c_initRetryDelayMs)); + L"MddBootstrapInitialize returned STATEREPOSITORY_E_DEPENDENCY_NOT_RESOLVED (0x%X); State Repository likely still indexing the just-installed package. Attempt %u/%u. Retrying after %ums.", + initHR, attempt, c_maxInitAttempts, c_initRetryDelayMs)); Sleep(c_initRetryDelayMs); } VERIFY_SUCCEEDED(initHR);