Repository navigation
[Microsoft.Android.Run] Delete the pulled device TRX after parsing - #13601
Merged
Merged
Conversation
AndroidTestAdapter.PullTrxFileAsync copies the device TRX to \/AndroidTestResults/<package>/. The file was never deleted. On CI agents, TMPDIR is the agent temp directory, and DotNetCoreCLI@2 publishes every *.trx file in that directory. The fake TRX from StreamingTests.InstrumentationWithoutStreamingReportsResultsFromTrx was published as an extra test run with a failed Tests.Two. Delete the local copy after it is parsed. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the temporary TRX cleanup change.
No open issues 🎉
What changed in this PR
This PR cleans up temporary device TRX files after parsing in Microsoft.Android.Run, preventing CI from publishing them as duplicate test runs.
Changes:
- Deletes the pulled TRX file in a
finallyblock, including when parsing fails. - Extends the existing instrumentation test to assert that the temporary file is removed.
| File | Description |
|---|---|
tests/Xamarin.Android.Tools.AndroidSdk-Tests/StreamingTests.cs |
Adds an assertion verifying temporary TRX cleanup. |
src/Microsoft.Android.Run/AndroidTestAdapter.cs |
Deletes the local device TRX copy after parsing. |
Review effort: Balanced
9 tasks
simonrozsival
approved these changes
Nov 18, 2026
simonrozsival
added a commit
that referenced
this pull request
Nov 21, 2026
The rebase onto cc7cbf6 kept the pre-rebase MSTest conversions of files that main had changed since aa688ac, which reverted those changes and broke the build. For each affected file, convert main's old and new NUnit versions with the same converter and merge the difference into the MSTest file: * cca255c (#13592): drop the Android lint tests and assertions. * 5b32fb1 (#13602): add RelativeDirectoriesUseProjectDirectory and the -mt CollectNonEmptyDirectories coverage. * 78ef747 (#13655): add OpenGenericProxiesKeepTheReflectionActivationConstructor. * 18b8940 (#13585): add the generator nullability/obsolete tests. * dcbd008 (#13580): add the AmbiguousFunctionMetadata_* tests. * 667e27a (#13621): add the sdkmanager package ID tests. * 5ecb8f7 (#13614): drop RunWithLoggingEnablesManagedTimingLogger. * 8287b17 (#13680), 4bfcc92 (#13681): restore the re-enabled tests and removed TODOs. * 5d81a0f (#13666): expect platform-tools 37.0.3. * 8442c75 (#13601): assert the pulled device TRX is deleted. Also drop the EnableNUnitRunner/OutputType lines that 857f463 (#13563) added to Xamarin.Android.Build.Tests and MSBuildDeviceIntegration; MSTestReferences.projitems sets both. Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1685875&view=ms.vss-test-web.build-test-results-tab
Context: f72b411
The Mac - .NET job of the
xamarin_android_tools_testsstage published an extra test run with two tests,Tests.One(passed) andTests.Two(failed). Thedotnet testoutput for the same job showed no failures:StreamingTests.InstrumentationWithoutStreamingReportsResultsFromTrxuses a fakeadbthat returns a hard-coded TRX file with these two results.AndroidTestAdapter.PullTrxFileAsync()copies that file to$TMPDIR/AndroidTestResults/<package>/device.trx, and nothing deletes it. On the agent,$TMPDIRis_work/_temp, which is also the--results-directorythatDotNetCoreCLI@2searches for*.trxfiles to publish. The test is ignored on Windows, so only the Mac job showed the problem.Delete the local TRX copy after it is parsed. The adapter only needs the parsed results, and
--report-trxwrites the real report. This also stopsdotnet testfrom leaving TRX files in the user's temp directory.Validation:
dotnet build tests/Xamarin.Android.Tools.AndroidSdk-Tests/Xamarin.Android.Tools.AndroidSdk-Tests.csproj -c Debug -p:AndroidToolsDisableMultiTargeting=false -p:DotNetTargetFrameworkVersion=11.0: succeeded, 0 warnings.dotnet build src/Microsoft.Android.Run/Microsoft.Android.Run.csproj -c Debug: succeeded, 0 warnings.InstrumentationWithoutStreamingReportsResultsFromTrxnow asserts that the pulled file is gone. I did not run it locally because it is ignored on Windows; the Mac CI job runs it.