[net11.0] Merge main into net11.0. - #26328
Conversation
## Summary - prevent late asynchronous `log stream` callbacks from writing after the diagnostic `StreamWriter` is closed - bound SIGINT, force-termination, and output-drain waits so cleanup cannot hang test jobs - report drain, flush, and disposal failures without failing an otherwise successful test run ## Root cause The macOS 27 test leg twice completed all suites successfully, then failed while shutting down diagnostic logging: ``` 5 suites passed, 0 suites failed. Unhandled exception. System.ObjectDisposedException: Cannot write to a closed TextWriter. ``` `WaitForExit (10_000)` waited for the process but not the asynchronous output handlers, so buffered `DataReceived` callbacks could arrive after writer disposal. This was split from #26280 at reviewer request so the infrastructure fix can flow through `main` independently. ## Validation - built `scripts/run-packaged-macos-tests/run-packaged-macos-tests.csproj` with 0 warnings and 0 errors - independent GPT-5.6 Sol and Claude Opus 4.8 max-reasoning concurrency reviews --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ebf4376b-3b4c-4492-acef-18607e6f4ea1 Copilot-Session: f09fc2f9-a071-47c6-84ff-02aa45e9e0c0
Remove `Foundation.RequiredMemberAttribute` and `Foundation.OptionalMemberAttribute` instances unconditionally using the platform assembly's embedded ILLink descriptor. Add linked-output metadata coverage that verifies both Foundation attributes are removed while `System.Runtime.CompilerServices.RequiredMemberAttribute` remains unaffected. 🤖 Pull request created by Copilot
Addresses a review comment from #26292. ## Problem In `tests/common/TestRuntime.LinkAll.cs`, the `IsLinkAll` property resolved the `+LinkerSentinel` type using a compile-time-constant type name: ```csharp link_all = typeof (TestRuntime).Assembly.GetType (typeof (TestRuntime).FullName + "+LinkerSentinel") is null; ``` The trimmer's dataflow analysis (dotnet/runtime#127319) can resolve that constant string and preserve the `LinkerSentinel` type, which would make `IsLinkAll` incorrectly report `false` even in link-all builds. ## Fix Introduce a `WorkAroundLinkerHeuristics` property that returns `""` at runtime (but the trimmer can't constant-fold) and append it to the type-name string, so the trimmer can no longer statically resolve `+LinkerSentinel`. This matches the pattern already used in `tests/linker/*` (e.g. `CommonLinkAllTest.cs`, `PreserveTest.cs`). 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ed (#26312) The test infrastructure (tests/common/shared-dotnet.csproj) unconditionally set the following ILC properties for every NativeAOT publish: IlcGenerateCompleteTypeMetadata=true (--completetypemetadata) IlcTrimMetadata=false (--reflectiondata:all) These were added as a workaround for NUnit 4.x, whose EquatablesComparer calls Type.GetInterfaceMap(), which requires complete type metadata (see nunit/nunit#3970). However, they were applied to *all* NativeAOT test apps, including apps that don't reference NUnit at all (e.g. SizeTestApp). Together these flags make every reflectable type keep complete metadata and every compiled method reflectable, which defeats trimming and dramatically inflates app size - for the trimmable-static registrar in particular they were the dominant driver of the complete-metadata cascade through the registered NSObject binding surface. This change gates both flags on `'$(ExcludeNUnitLiteReference)' != 'true'`, the exact same condition that already governs whether NUnitLite is referenced and whether nunit.framework.targets is imported. Apps that reference NUnit keep the workaround; apps that don't no longer pay the size cost. The expected app-size files are regenerated accordingly - NativeAOT sizes (and especially the trimmable-static variants) drop substantially. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Filter, NSSecureCoding, MDLVertexFormatExtensions, UIBarItem, CNInstantMessageAddress, CNSocialProfile, NSPrintInfo (#26314) Improve XML documentation for 10 types: - UISegmentedControl - VNUtils - CGVector - CIFilter - NSSecureCoding - MDLVertexFormatExtensions - UIBarItem - CNInstantMessageAddressOption / CNInstantMessageAddress - CNSocialProfileOption / CNSocialProfile - NSPrintInfo Changes include adding missing summaries, fixing tag ordering (summary before param), removing empty elements, and normalizing indentation. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…perties (#26310) Expand the documentation for the two on-demand-resources (ODR) build properties. The difference between them caused customer confusion in issue #26218, where a user thought on-demand resources were disabled by default (they aren't on iOS) and that the "Embed on-demand resources in the app bundle" option was what turned the feature on (it doesn't). * `EnableOnDemandResources`: explain that this is what turns ODR on, and show how to tag a resource with `ResourceTags` metadata — using `Update` rather than `Include` for resources that are already part of the project's default resources, and mentioning the `MauiAsset` equivalent for .NET MAUI projects. * `EmbedOnDemandResources`: clarify that it does NOT enable ODR, and only controls where asset packs are placed when packaging an IPA for distribution. The two entries now cross-reference each other. Ref #26218 (which revealed the confusing/lacking documentation). 🤖 Pull request created by Copilot
There was a problem hiding this comment.
Pull request overview
This PR merges main into the net11.0 branch, bringing over recent test coverage, linker behavior adjustments, documentation improvements, and assorted API XML-doc cleanups relevant to trimming/NativeAOT and packaging behavior.
Changes:
- Added a new dotnet unit test + a small test app to validate that
Foundation.RequiredMemberAttribute/Foundation.OptionalMemberAttributeattribute instances are removed by trimming, while the BCLRequiredMemberAttributeremains. - Reduced NativeAOT test app sizes by only enabling “complete type metadata” when NUnit is actually referenced, and updated size-baseline expected outputs accordingly.
- Improved reliability/robustness of packaged macOS test execution logging, and expanded build-properties documentation for on-demand resources.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/dotnet/UnitTests/PublishTrimmedTest.cs | Adds a trimming regression test that inspects output assemblies with Cecil to ensure specific Foundation attribute instances are removed. |
| tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt | Updates expected NativeAOT size baselines after metadata/linking changes. |
| tests/dotnet/LinkerAttributesTestApp/LinkerAttributesTestApp.csproj | Introduces a minimal iOS test app used by the new trimming regression test. |
| tests/dotnet/LinkerAttributesTestApp/AppDelegate.cs | Implements the test app code that exercises Required/Optional member attributes and required properties. |
| tests/common/TestRuntime.LinkAll.cs | Adjusts link-all detection to avoid trimmer constant-folding issues affecting GetType heuristics. |
| tests/common/shared-dotnet.csproj | Makes NativeAOT “complete metadata” settings conditional on NUnit presence to avoid unnecessary size bloat. |
| src/ILLink.LinkAttributes.xml.in | Adds trimming directives to remove instances of Foundation.RequiredMemberAttribute / Foundation.OptionalMemberAttribute. |
| scripts/run-packaged-macos-tests/run-packaged-macos-tests.cs | Prevents late async log callbacks from writing to a disposed writer; improves shutdown/drain logic. |
| docs/building-apps/build-properties.md | Expands documentation for on-demand resources packaging behavior and related properties. |
| src/Vision/VNUtils.cs | Cleans up XML docs (removes placeholder remarks/values; improves param docs). |
| src/UIKit/UISegmentedControl.cs | Cleans up constructor XML docs (removes placeholder remarks; improves param docs). |
| src/UIKit/UIBarItem.cs | Cleans up XML docs (removes placeholder docs; improves param docs). |
| src/ModelIO/MDLStructs.cs | Cleans up XML docs (removes placeholder remarks; improves param docs). |
| src/Foundation/NSSecureCoding.cs | Cleans up XML docs (removes placeholder remarks/returns; improves param docs). |
| src/CoreImage/CIFilter.cs | Cleans up XML docs (removes placeholder docs; improves param docs). |
| src/CoreGraphics/CGVector.cs | Cleans up XML docs (removes placeholder docs; improves summaries/params/returns). |
| src/Contacts/CNSocialProfile.cs | Cleans up XML docs (removes placeholder remarks; improves param docs). |
| src/Contacts/CNInstantMessageAddress.cs | Cleans up XML docs and fixes punctuation in summaries/param docs. |
| src/AppKit/NSPrintInfo.cs | Replaces placeholder XML docs with meaningful summaries. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
❌ [CI Build #a8f6e4e] Prepare .NET Release failed ❌The following jobs reported a non-successful result:
📦 Signed NuGet packages (32 packages)iOS
MacCatalyst
macOS
tvOS
Other
Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
✅ 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 |
🔥 [CI Build #5640390] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 1 tests failed, 255 tests passed. Failures❌ monotouch tests (iOS)1 tests failed, 22 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ 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 |
No description provided.