[tests] Add MaxSupportedOSPlatformVersion regression test project - #26567
Conversation
This adds a new test app (tests/dotnet/MaxSupportedOSPlatformVersion) that deliberately does NOT import tests/common/shared-dotnet.csproj, so its SupportedOSPlatformVersion isn't pinned to each platform's minimum. Instead, it falls back to the .NET SDK's own default, which is the highest installed TargetPlatformVersion (i.e. the newest Xcode SDK version) - the same situation that made MetalShadersNotRecompiled the only test in IncrementalBuildTest.cs to fail when building with Xcode 27. A corresponding unit test (MaxSupportedOSPlatformVersionTest.Build) was added with one test case per platform (iOS, tvOS, MacCatalyst, macOS). Verified against Xcode 27 (without the registrar fix applied): the iOS build fails as expected, because the static registrar emits a native declaration for UIAccelerometerDelegate, which the iOS 27.0 SDK headers mark unavailable/obsoleted, and Debug dotnet builds for iOS don't trim (TrimMode=copy), so the type is never removed before the registrar processes it. tvOS and macOS pass, because UIAccelerometer/UIAccelerometerDelegate are not available on those platforms ([NoTV], and UIKit types aren't used on the AppKit-based macOS). MacCatalyst also passes, but for a different reason: its Debug dotnet build defaults to PublishTrimmed=true/TrimMode=partial (unlike iOS's TrimMode=copy), so ILLink trims away the unreferenced UIAccelerometer types before the registrar ever sees them. No fix for the underlying registrar issue is included here; this is purely a regression test that documents the gap in the test matrix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c1b6973c-0330-4e26-a8b5-153fef490a30
Set TrimMode=copy so all platforms behave consistently. Without this, Mac Catalyst's Debug 'dotnet build' defaulted to TrimMode=partial (unlike iOS's TrimMode=copy), which trimmed away the unreferenced UIAccelerometer types before the registrar processed them, masking the same bug that affects iOS. With trimming disabled, both iOS and MacCatalyst now fail with the expected clang error (UIAccelerometerDelegate obsoleted in the platform's 27.0 SDK), while tvOS and macOS still pass since UIAccelerometer isn't available on those platforms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c1b6973c-0330-4e26-a8b5-153fef490a30
There was a problem hiding this comment.
🟢 Approval recommended
The changes are additive and align with existing test-project patterns, with only minor consistency/cleanup nits noted inline.
Pull request overview
Adds a new regression-test app and corresponding unit test to ensure the build/test matrix covers the scenario where SupportedOSPlatformVersion is not pinned (so it floats to the newest installed SDK’s TargetPlatformVersion), which can surface static-registrar failures with newly-obsoleted SDK types.
Changes:
- Added
MaxSupportedOSPlatformVersionTest.Buildunit test with one build case per Apple platform. - Added a new
tests/dotnet/MaxSupportedOSPlatformVersionmulti-platform dotnet app that intentionally does not importtests/common/shared-dotnet.csproj, and explicitly disables trimming viaTrimMode=copy. - Added Makefile plumbing to build the new test app in the existing dotnet test infrastructure.
File summaries
| File | Description |
|---|---|
| tests/dotnet/UnitTests/MaxSupportedOSPlatformVersionTest.cs | New NUnit build test that exercises the “floating SupportedOSPlatformVersion” scenario across iOS/tvOS/Mac Catalyst/macOS. |
| tests/dotnet/MaxSupportedOSPlatformVersion/Makefile | Hooks the new test project into the shared dotnet test make targets. |
| tests/dotnet/MaxSupportedOSPlatformVersion/AppDelegate.cs | Minimal entry point that keeps the platform assembly referenced to preserve registrar-relevant types. |
| tests/dotnet/MaxSupportedOSPlatformVersion/shared.csproj | Shared project settings; intentionally avoids shared-dotnet.csproj and sets TrimMode=copy. |
| tests/dotnet/MaxSupportedOSPlatformVersion/shared.mk | Shared per-platform make include for building via shared-dotnet.mk. |
| tests/dotnet/MaxSupportedOSPlatformVersion/iOS/MaxSupportedOSPlatformVersion.csproj | iOS TFM project that imports the shared settings. |
| tests/dotnet/MaxSupportedOSPlatformVersion/iOS/Makefile | iOS make target that includes the shared make logic. |
| tests/dotnet/MaxSupportedOSPlatformVersion/tvOS/MaxSupportedOSPlatformVersion.csproj | tvOS TFM project that imports the shared settings. |
| tests/dotnet/MaxSupportedOSPlatformVersion/tvOS/Makefile | tvOS make target that includes the shared make logic. |
| tests/dotnet/MaxSupportedOSPlatformVersion/MacCatalyst/MaxSupportedOSPlatformVersion.csproj | Mac Catalyst TFM project that imports the shared settings. |
| tests/dotnet/MaxSupportedOSPlatformVersion/MacCatalyst/Makefile | Mac Catalyst make target that includes the shared make logic. |
| tests/dotnet/MaxSupportedOSPlatformVersion/macOS/MaxSupportedOSPlatformVersion.csproj | macOS TFM project that imports the shared settings. |
| tests/dotnet/MaxSupportedOSPlatformVersion/macOS/Makefile | macOS make target that includes the shared make logic. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 2
- Review effort level: Lite
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #6f69640] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 264 tests passed 🎉 Tests counts✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS tests✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
This adds a new .NET test app project (tests/dotnet/MaxSupportedOSPlatformVersion) that deliberately does not import tests/common/shared-dotnet.csproj, so its SupportedOSPlatformVersion isn't pinned to each platform's minimum. Instead, it falls back to the .NET SDK's own default, which is the highest installed TargetPlatformVersion (i.e. the newest Xcode SDK version) - the same situation that caused the
MetalShadersNotRecompiledtest (in IncrementalBuildTest.cs) to be the only test failing when building with Xcode 27.A corresponding unit test (MaxSupportedOSPlatformVersionTest.Build) was added with one test case per platform (iOS, tvOS, MacCatalyst, macOS).
Verified against Xcode 27 (without the registrar fix applied):
No fix for the underlying registrar issue is included here; this is purely a regression test that documents a gap in the test matrix (deployment targets that float to the newest/highest SDK version, rather than being explicitly pinned).