dotnet / dotnet/macios

[CI] Windows remote MSB3021: Source array was not long enough copying iOS outputs

Open
#26,562 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 13h
Merged PRs (30d)
96

Description

## Failure signature

Windows Integration remote iOS builds intermittently fail in `Xamarin.iOS.Common.After.targets` with:

```text
error MSB3021: Unable to copy file "...".
Source array was not long enough. Check the source index, length, and the array's lower bounds.
```

The failing source file varies, but the stable root is the MSBuild copy operation and identical `Source array was not long enough` exception.

## Confirmed occurrences

| PR / head | Azure occurrence | Evidence |
|---|---|---|
| #26495 / `0a76122a3e88077de5c52fc48987562aff5e1aff` | Build 15180799 attempt 1, Windows Integration `Dotnet tests`, `Run .NET tests remotely` | [`BuildEmbeddedFrameworkInBindingProjectApp(iOS, "iossimulator-arm64")`](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=15180799&view=logs&j=eac261bd-81a1-5958-df8d-94842fc987be&t=7eef1eb5-91f9-5641-dbf4-d80937931e01) failed while copying `Microsoft.iOS.pdb`. |
| #26554 / `7e8c4edb02eb98aa7ad72f1da2e6755a61af1517` | Build 15210709 attempt 1, Windows Integration `Dotnet tests`, `Run .NET tests remotely` | [`BuildIpaAndArchiveOnRemoteWindowsTest(iOS, "ios-arm64")`](https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=15210709&view=logs&j=eac261bd-81a1-5958-df8d-94842fc987be&t=7eef1eb5-91f9-5641-dbf4-d80937931e01) failed while copying `R2R/_Microsoft.iOS.TypeMaps.dll` and `R2R/_MonoTouch.Dialog.TypeMap.dll`. |

**Count:** 2 confirmed occurrences across 2 distinct monitored PRs.

First observed: `2026-09-02T09:07:59Z`
Latest observed: `2026-09-04T06:33:00Z`

## Classification and retry evidence

**Genuinely flaky Windows remote MSBuild copy failure.**

- The same exception occurred in different PRs, tests, and source files.
- The #26495 full **Windows Integration Tests** stage retry succeeded.
- In #26554, the test failure was recorded before the job reached its 120-minute limit. The timeout subsequently canceled only later artifact publication and is not the root cause.
- Other local and remote Windows tests in the same #26554 job passed.

## Impact

The failure makes the entire simulator validation check red after a lengthy Windows Integration run, even though unrelated package, API-diff, simulator, and AppSize checks pass.

## Investigation

- Inspected Azure build metadata, full stage/job/task timeline, remote-test output, failure-gate output, and the published TestSummary for both occurrences.
- Correlated the normalized MSBuild exception, target, and retry outcome.
- Searched all open and closed `dotnet/macios` issues separately by the exact exception, `MSB3021`, target file, tests, and copied outputs; no matching issue existed.

## Workaround

Rerun the entire **Windows Integration Tests** stage. Do not rerun only the failed job. Azure logs and artifacts are retention-limited.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with Xamarin.iOS.Common.After.targets and the two Azure failure logs for Build 15180799 and Build 15210709. Compare the remote iOS copy operations and retry behavior in the Windows Integration Tests stage. Done means the intermittent MSB3021 failure is addressed and the stage completes without requiring a full-stage rerun.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
build-system, ci-cd, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.