Skip to content

[Flaky test] InstallAndroidDependenciesTest (GoogleV2/Xamarin, CoreCLR) fails intermittently across PRs #11973

Description

@simonrozsival

Affected test

Xamarin.Android.Build.Tests.AndroidDependenciesTests.InstallAndroidDependenciesTest

Both parameter combinations that exercise the network-dependent SDK/JDK install path have been observed failing intermittently across multiple, unrelated PRs:

  • InstallAndroidDependenciesTest("GoogleV2", CoreCLR)
  • InstallAndroidDependenciesTest("Xamarin", CoreCLR)

Description

These tests fail randomly (not tied to any specific code change) on the public dnceng-public dotnet-android CI pipeline. The InstallAndroidDependencies target downloads/installs the Android SDK and JDK from a manifest, so the test is inherently sensitive to network flakiness and manifest availability.

The failures are short (2–4 s) and manifest as a generic build failure, e.g.:

Failed InstallAndroidDependenciesTest("GoogleV2",CoreCLR) [4 s]
  Error Message:
   Xamarin.ProjectTools.FailedBuildException : Build failure: UnnamedProject.csproj
   Build log recorded at .../temp/InstallAndroidDependenciesTestGoogleV2CoreCLR/install-deps.log
  Stack Trace:
     at Xamarin.ProjectTools.Builder.BuildInternal(...) in Common/Builder.cs:line 417
     at Xamarin.ProjectTools.ProjectBuilder.Build(...) in Common/ProjectBuilder.cs:line 134
     at Xamarin.Android.Build.Tests.AndroidDependenciesTests.InstallAndroidDependenciesTest(String manifestType, AndroidRuntime runtime) in AndroidDependenciesTests.cs:line 72
Failed InstallAndroidDependenciesTest("Xamarin",CoreCLR) [2 s]
  Error Message:
   Xamarin.ProjectTools.FailedBuildException : Build failure: UnnamedProject.csproj
   Build log recorded at .../temp/InstallAndroidDependenciesTestXamarinCoreCLR/install-deps.log

Command that is run under the test:

dotnet build UnnamedProject.csproj /t:InstallAndroidDependencies /noconsolelogger \
  "/flp1:LogFile=.../install-deps.log;Encoding=UTF-8;Verbosity=detailed" -nodeReuse:false @".../project.rsp"

Source

Notes / next steps

  • The full failure reason lives in the per-test install-deps.log artifact, which is not surfaced in the test output above. Collecting that log from a failing run will confirm whether this is a transient download/network failure vs. a real regression.
  • If confirmed to be network flakiness, consider adding a retry around the InstallAndroidDependencies invocation or marking the test with a known-flaky annotation.

Tracking issue to correlate these intermittent failures across PRs.

Activity

  1. simonrozsival commented on Jul 13, 2026

    @simonrozsival
    MemberAuthor

    Still failing after the retry mitigation (#11974) — the retry isn't actually engaging

    New occurrence of InstallAndroidDependenciesTest("GoogleV2", CoreCLR), after #11974 was merged (2026-07-06):

    • Build: dnceng-public build 1506492
    • Case: InstallAndroidDependenciesTest("GoogleV2", CoreCLR), Release
    • Duration: [5 s], Found Time Elapsed 00:00:04.61
    Failed InstallAndroidDependenciesTest("GoogleV2",CoreCLR) [5 s]
      Error Message:
       Xamarin.ProjectTools.FailedBuildException : Build failure: UnnamedProject.csproj
       Build log recorded at .../temp/InstallAndroidDependenciesTestGoogleV2CoreCLR/install-deps.log
      Stack Trace:
         at Xamarin.ProjectTools.Builder.BuildInternal(...) in Common/Builder.cs:line 417
         at Xamarin.ProjectTools.ProjectBuilder.Build(...) in Common/ProjectBuilder.cs:line 134
         at Xamarin.Android.Build.Tests.AndroidDependenciesTests.InstallAndroidDependenciesTest(...) in AndroidDependenciesTests.cs:line 82
    

    The 3× retry from #11974 is effectively a no-op

    The retry loop calls the builder like this:

    for (int attempt = 1; attempt <= maxInstallAttempts; attempt++) {
        // wipe + recreate sdkPath / jdkPath ...
        if (b.Build (proj, parameters: buildArgs.ToArray ())) {   // AndroidDependenciesTests.cs:82
            installSucceeded = true;
            break;
        }
        TestContext.WriteLine ($"InstallAndroidDependencies attempt {attempt} of {maxInstallAttempts} failed. ...");
        if (attempt < maxInstallAttempts)
            Thread.Sleep (TimeSpan.FromSeconds (10));
    }

    But ProjectBuilder sets ThrowOnBuildFailure = true in its constructor (Common/ProjectBuilder.cs:34), and Builder throws on a failed build instead of returning false (Common/Builder.cs:414-417):

    if (!result && ThrowOnBuildFailure) {
        ...
        throw new FailedBuildException (message);
    }

    InstallAndroidDependenciesTest never sets ThrowOnBuildFailure = false (it's only disabled in two other tests in the same file). So the first failed attempt throws FailedBuildException, which propagates straight out of the for loop — attempts 2 and 3 never run.

    This build's log confirms it: a single build invocation, ~4.6 s elapsed, total [5 s], and the FailedBuildException stack trace above. A working retry would instead log InstallAndroidDependencies attempt 1 of 3 failed, sleep 10 s, and take >20 s across up to three attempts.

    Suggested fix

    Make the retry actually catch failures, e.g. either:

    1. Set b.ThrowOnBuildFailure = false; before the loop and keep the if (b.Build (...)) return-value check (assert after the loop as today), or
    2. Wrap b.Build (...) in try { ... } catch (FailedBuildException) { ... } inside the loop.

    The underlying network/download failure still needs to be characterized from the per-test install-deps.log artifact, so this issue should stay open regardless — but the current mitigation won't help until the retry can survive a failed attempt.

  2. locked and limited conversation to collaborators on Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions