KEMBAR78
[Testing] Run UI tests with CoreCLR on Android by rmarinho · Pull Request #30842 · dotnet/maui · GitHub
Skip to content

Conversation

rmarinho
Copy link
Member

@rmarinho rmarinho commented Jul 25, 2025

Description of Change

Add UITests stage for using CoreCLR, enable NativeAOT for UITEsts.

This pull request introduces support for the CoreCLR runtime variant, refactors build and test scripts for better maintainability, and updates the pipeline configurations. The most significant changes include adding CoreCLR as a runtime option, enhancing build tasks to accommodate the new runtime, and updating pipeline files to support CoreCLR-specific builds and tests.

Seems we weren't actually build also the NativeAOT uitest step correctly, so fixing that too on this PR.

CoreCLR Runtime Support:

  • Added CoreCLR as a new runtime variant in the RuntimeVariant enum and introduced a corresponding flag USE_CORECLR in eng/cake/dotnet.cake.
  • Updated the Task("uitests-apphost") to include CoreCLR-specific build properties, such as UseMonoRuntime and TargetFramework.

Build Script Refactoring:

  • Introduced DefaultDotnetVersion to support dynamic target framework versions via arguments or environment variables.
  • Standardized formatting and improved readability across multiple tasks, such as dotnet, dotnet-local-workloads, and dotnet-samples. [1] [2] [3]
  • Enhanced exception handling and formatting in the GenerateCgManifest task and RunTestWithLocalDotNet method. [1] [2]

Pipeline Updates:

  • Modified ui-tests-build-sample.yml to include CoreCLR as a runtime variant and added conditions for publishing CoreCLR-specific artifacts. [1] [2]
  • Added CoreCLR-specific stages and jobs in ui-tests.yml for both build and test workflows. [1] [2]
  • Updated the macOS version to macOS-15 and Android API levels to 36 in ui-tests.yml. [1] [2]

Project Configuration:

  • Suppressed additional warnings (IL2026, IL2091, etc.) in the Controls.TestCases.HostApp.csproj file to address compatibility issues.

Issues Fixed

Fixes #30278

@Copilot Copilot AI review requested due to automatic review settings July 25, 2025 16:31
@rmarinho rmarinho requested a review from a team as a code owner July 25, 2025 16:31
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces CoreCLR runtime support to the .NET MAUI UI testing infrastructure. The changes enable building and testing MAUI applications using the CoreCLR runtime alongside the existing Mono and NativeAOT variants.

Key changes include:

  • Added CoreCLR as a new runtime variant in build and pipeline configurations
  • Enhanced UI test pipelines to support CoreCLR-specific build and test stages
  • Updated build infrastructure to handle CoreCLR-specific properties and configurations

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Controls.TestCases.HostApp.csproj Added warning suppressions for IL analyzer warnings
ui-tests.yml Updated macOS version and Android API levels for test environments
ui-tests.yml (common) Added CoreCLR build and test stages for Android UI tests
ui-tests-steps.yml Added artifact download step for CoreCLR test samples
ui-tests-build-sample.yml Added CoreCLR-specific artifact publishing conditions
dotnet.cake Implemented CoreCLR runtime variant support and build configuration
Comments suppressed due to low confidence (1)

src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj:26

  • Adding new warning suppressions (IL2026, IL2091, IL2067, IL2072, IL2087, IL3050) without corresponding test cases. These IL analyzer warnings are related to trimming and AOT compatibility. Please ensure there are test cases in TestCases.Shared.Tests that verify the behavior when these warnings would normally be triggered, particularly for CoreCLR scenarios.
    <NoWarn>$(NoWarn);CS0618;CS0672;XC0618;XC0022;XC0023;IL2026;IL2091;IL2067;IL2072;IL2087;IL3050</NoWarn>

<WindowsPackageType>None</WindowsPackageType>
<!-- TODO: remove these obsolete nowarns and fix it in code -->
<NoWarn>$(NoWarn);CS0618;CS0672;XC0618;XC0022;XC0023</NoWarn>
<NoWarn>$(NoWarn);CS0618;CS0672;XC0618;XC0022;XC0023;IL2026;IL2091;IL2067;IL2072;IL2087;IL3050</NoWarn>
Copy link
Member Author

@rmarinho rmarinho Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this was not running with NAtiveAOT it was throwing the errors.

@rmarinho rmarinho changed the title Fix 30278 [Testing] Run UI tests with CoreCLR on Android Jul 25, 2025
@rmarinho
Copy link
Member Author

/rebase

@rmarinho
Copy link
Member Author

rmarinho commented Aug 4, 2025

/rebase

@rmarinho
Copy link
Member Author

/rebase

@rmarinho rmarinho added this to the .NET 10.0-rc1 milestone Aug 18, 2025
@rmarinho rmarinho moved this from Todo to Ready To Review in MAUI SDK Ongoing Aug 18, 2025
@rmarinho rmarinho requested a review from simonrozsival August 18, 2025 11:51
@rmarinho rmarinho merged commit fa98903 into net10.0 Aug 18, 2025
148 checks passed
@rmarinho rmarinho deleted the fix-30278 branch August 18, 2025 11:59
@github-project-automation github-project-automation bot moved this from Ready To Review to Done in MAUI SDK Ongoing Aug 18, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants