[net11.0] Flow merge validation CI fixes - #37036
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37036Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37036" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 37faae15-0e4c-46fd-9bef-f3006c8aaee8
Use a test-specific NuGet configuration that permits only Avalonia.Controls.Maui packages from NuGet.org while retaining the existing approved feeds for the rest of the dependency graph. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 37faae15-0e4c-46fd-9bef-f3006c8aaee8
Keep NuGet.org restricted by package-source mapping while including the Avalonia transitive dependency graph required by the template build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 37faae15-0e4c-46fd-9bef-f3006c8aaee8
Include the non-Avalonia-named MicroCom runtime dependency in the test-only NuGet.org package-source mapping while keeping all other packages on approved feeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 37faae15-0e4c-46fd-9bef-f3006c8aaee8
Prevent the MainThread bridge and dispatcher tests from clearing their shared process-global DispatcherProvider state while another test is running. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 37faae15-0e4c-46fd-9bef-f3006c8aaee8
2bfc50a to
34979f9
Compare
There was a problem hiding this comment.
Pull request overview
This PR flows merge-validation CI fixes back to net11.0, targeting three areas: (1) integration tests for Avalonia-enabled templates, (2) unit-test stability by disabling parallelization for dispatcher-provider-mutating tests, and (3) device-test compilation fixes via namespace/import cleanup and a restored override hook for modal test setup.
Changes:
- Updated
SimpleTemplateTestto run Avalonia template creation without restore and to generate a restrictedNuGet.configwith package source mapping forAvalonia*/MicroCom.*. - Added a new xUnit collection definition to serialize tests that mutate the process-global
DispatcherProvider, and applied it toDispatcherTestsandMainThreadBridgeTests. - Restored an overridable modal device-test setup hook and fixed iOS device-test using directives ordering/namespace availability.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs | Adds Avalonia-specific dotnet new/NuGet restore behavior and generates a dedicated NuGet config with source mapping. |
| src/Core/tests/UnitTests/TestClasses/DispatcherProviderTestCollection.cs | Introduces a non-parallel xUnit collection for tests that mutate global dispatcher provider state. |
| src/Core/tests/UnitTests/Hosting/MainThreadBridgeTests.cs | Assigns MainThreadBridgeTests to the non-parallel dispatcher-provider collection. |
| src/Core/tests/UnitTests/Dispatching/DispatcherTests.cs | Assigns DispatcherTests to the non-parallel dispatcher-provider collection. |
| src/Controls/tests/DeviceTests/Elements/TabbedPage/TabbedPageTests.iOS.cs | Restores/normalizes required using directives for iOS device-test compilation. |
| src/Controls/tests/DeviceTests/Elements/Modal/ModalTests.cs | Makes modal test setup overridable again via a protected virtual entry point. |
| namespace Microsoft.Maui.UnitTests.Hosting | ||
| { | ||
| [Category(TestCategory.Core, TestCategory.Hosting)] | ||
| [Collection(nameof(DispatcherProviderTestCollection))] | ||
| public class MainThreadBridgeTests : IDisposable |
| @@ -47,6 +49,12 @@ public void Build(string id, string framework, string config, bool shouldPack, s | |||
|
|
|||
| var buildProps = BuildProps; | |||
|
|
|||
| if (usesAvalonia) | |||
| { | |||
| buildProps.RemoveAll(p => p.StartsWith("RestoreConfigFile=", StringComparison.Ordinal)); | |||
| buildProps.Add($"RestoreConfigFile={CreateAvaloniaNuGetConfig(projectDir)}"); | |||
| } | |||
| // Technically these tests are useless because they cannot test shipping code as they are | ||
| // none of the platforms. However, they sort of do test the test dispatcher... | ||
| [Category(TestCategory.Core, TestCategory.Dispatching)] | ||
| [Collection(nameof(DispatcherProviderTestCollection))] | ||
| public class DispatcherTests : IDisposable |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial code review
No high-confidence issues found on the current head.
The dispatcher-provider fix places both test classes that mutate the process-global provider in the same nonparallel xUnit collection. The Avalonia template path skips the template post-action restore, then restores through a generated config that limits NuGet.org to Avalonia* and MicroCom.* while retaining the approved internal feeds for the remaining dependency graph.
Test coverage assessment: Appropriate for these test-infrastructure changes: both global-state-mutating classes are serialized together, the existing Avalonia build theory exercises template creation and build restore, and the iOS change is compile-scoped.
Prior review reconciliation: The earlier namespace-resolution comments are not applicable because C# resolves the collection type from the enclosing parent namespace. The earlier Avalonia restore concern was also rechecked against the current implementation and dependency mapping; no unresolved issue remains.
Methodology: 3 independent reviewers with adversarial consensus + repo domain specialist. Two single-reviewer configuration concerns were disputed and discarded after repository/feed verification.
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Flows the remaining CI fixes discovered while validating the automated `net11.0` to Preview 7 merge in dotnet#36986 back to `net11.0`. - Adds the missing iOS hosting namespace so the TabbedPage device tests compile. - Makes Avalonia template tests skip template post-action restore and use a test-specific NuGet configuration. Existing approved feeds remain mapped to all packages; NuGet.org is limited to the external `Avalonia*` and `MicroCom.*` dependency families. - Serializes `DispatcherTests` and `MainThreadBridgeTests`, which both mutate the process-global `DispatcherProvider`, preventing the Helix race observed in build 1536641. The modal device-test override fix was removed from this PR after it landed independently in dotnet#37030. These remaining fixes produced a successful aggregate `maui-pr` run for dotnet#36986 in [build 1536659](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1536659). The source-only version-property merge hardening remains separately tracked by dotnet#37019. ## Testing - `Core.UnitTests`: 22 targeted `DispatcherTests` and `MainThreadBridgeTests` passed on .NET 11 RC1 after rebasing. - iOS device-test compilation was validated while fixing dotnet#36986. - Avalonia integration scenarios restored through the restricted package-source mapping in successful `maui-pr` build 1536659. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Vally Fixture <vally-fixture@example.invalid> Copilot-Session: 37faae15-0e4c-46fd-9bef-f3006c8aaee8
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
Flows the remaining CI fixes discovered while validating the automated
net11.0to Preview 7 merge in #36986 back tonet11.0.Avalonia*andMicroCom.*dependency families.DispatcherTestsandMainThreadBridgeTests, which both mutate the process-globalDispatcherProvider, preventing the Helix race observed in build 1536641.The modal device-test override fix was removed from this PR after it landed independently in #37030.
These remaining fixes produced a successful aggregate
maui-prrun for #36986 in build 1536659.The source-only version-property merge hardening remains separately tracked by #37019.
Testing
Core.UnitTests: 22 targetedDispatcherTestsandMainThreadBridgeTestspassed on .NET 11 RC1 after rebasing.maui-prbuild 1536659.