[net11.0] Merge main into net11.0. - #26424
Conversation
…Function` when the type actually has any `UnmanagedCallersOnly` methods to look up. (#26364) Only override `NSObjectProxyAttribute.LookupUnmanagedFunction` when the type actually has any `UnmanagedCallersOnly` methods to look up. The method is now virtual instead of abstract, and the base implementation returns `IntPtr.Zero`, which is exactly what the generated override did for types without any such methods. Copilot-Session: 6aeeddfd-3bd8-4129-ad90-7292860c4b66 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Bumps [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) from 0.6.0 to 0.6.1.
…in .NET 11+. (#26409) The trimmable-static registrar has been the default for NativeAOT on .NET 11+ since #26346. This makes it the default for **CoreCLR** as well, and enables the `PrepareAssemblies` flow along with it. Mono keeps the managed-static registrar — only CoreCLR and NativeAOT were measured and tested. ## Why `PrepareAssemblies` has to come along `PrepareAssemblies=true` is *required* for the trimmable-static registrar to produce a small app. The assembly-preparer writes the generated type map assemblies to disk (marked with `[AssemblyMetadata ("IsTrimmable", "True")]`) *before* the trimmer runs, so the trimmer treats them as ordinary trimmable input assemblies. Without it, the type map assemblies are created from inside the trimmer, where they end up with the `copy` assembly action — which means they're never trimmed, and since they reference every Objective-C type in the app, nothing else can be trimmed either. That's what made trimmable-static apps ~3x larger on CoreCLR, and it's why the old comment claimed the trimmable-static registrar couldn't be used outside of NativeAOT. That comment was simply wrong, and has been rewritten. ## Notes - The `$(UseMonoRuntime)` defaults had to be **moved above** the registrar defaults, because the latter now check `$(UseMonoRuntime)` at evaluation time and would otherwise read an empty value. This also matches the layout on `net11.0`, which reduces the merge conflict when this flows. - The `$(Registrar)` check on `PrepareAssemblies`/`PostProcessAssemblies` means a CoreCLR app that explicitly opts back in to the managed-static registrar doesn't get `PrepareAssemblies` enabled — that combination makes apps *larger*. NativeAOT keeps getting `PrepareAssemblies` regardless of the registrar (pre-existing behavior). - **This is inert on `main`**, since `main` is still .NET 10. It takes effect when it flows into `net11.0`. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Improve XML documentation for: - `VSAccountProviderAuthenticationSchemeExtensions` - `EKCalendarChooserSelectionStyle` - `EKCalendarChooserDisplayStyle` - `EKEventViewAction` - `EKEventEditViewAction` - `CMMagneticFieldCalibrationAccuracy` - `SSReadingListError` - `CTErrorDomain` - `CTCellularDataRestrictedState` - `CTCellularPlanProvisioningAddPlanResult` Each type is documented in a separate commit. The Cecil documentation baseline is updated for the newly documented `CTCellularPlanProvisioningAddPlanResult` API. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… switch. Fixes #26104. (#26140) Replace the hand-written IL rewrite of `[NS|UI]Application.EnsureUIThread` with an `ObjCRuntime.Runtime.CheckForIllegalCrossThreadCalls` trimmer feature switch, driven by a new `$(CheckForIllegalCrossThreadCalls)` MSBuild property (defaults to the build configuration: on for debug, off for release). * Remove `ProcessEnsureUIThread` (and its case) from the linker's `OptimizeGeneratedCode` step, and mark the now-orphaned `--optimize=remove-uithread-checks` flag as removed (following the existing `inline-intptr-size` convention). * Emit the `ObjCRuntime.Runtime.CheckForIllegalCrossThreadCalls` `RuntimeHostConfigurationOption` from `Xamarin.Shared.Sdk.targets` and stub the `EnsureUIThread` method body via ILLink substitutions on all four platforms when the feature is off. * Make `[NS|UI]Application.CheckForIllegalCrossThreadCalls` trimmable when the checks are off, without an API break: drop the field's `= true` initializer and instead set it from the application startup path, guarded by an internal feature-switched `Runtime.CheckForIllegalCrossThreadCalls` getter. When the feature is off the getter substitutes to a constant `false`, so the assignment is dead-code-eliminated and — with `EnsureUIThread` also stubbed — the field can be trimmed away entirely. * Document the new `$(CheckForIllegalCrossThreadCalls)` property and update `optimizations.md`. Because the property is emitted as a runtime feature switch, it also takes effect when trimming is disabled (the field reflects the property value at runtime); trimming is only needed to physically remove the check code. Add `EnsureUIThreadChecksTest` (with a dedicated `EnsureUIThreadApp` project that keeps `EnsureUIThread` reachable) verifying the feature switch value and that, in the app bundle, `EnsureUIThread` is stubbed and the field is trimmed when the checks are off (iOS + macOS). Fixes #26104 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…25861) (#26259) Scenario: An object whose native `init` returns a different pointer than `alloc` (e.g. `CKRecordZoneID`) frees its alloc'd address. If another object (e.g. a `__MonoMac_NSAsyncActionDispatcher`) is allocated at that just-freed address on another thread and registered in `object_map`, the first object's `Handle` setter would then unconditionally `UnregisterNSObject` its stale alloc handle and clobber the second object's registration. A later native->managed marshal of that address then fails ("Could not find an existing managed instance", errors 8027/8034/8035). Fix: * Defer `object_map` registration until after `init` for user types. User types carry their gchandle in a native ivar (set at alloc time), which is self-cleaning when the address is freed/reused, so it's a safe authoritative fallback lookup during `init`. Only the final (post-`init`) handle is added to `object_map`. Direct bindings have no ivar, so they stay eagerly registered and are protected by the ownership-aware unregister below. * Use an ownership-aware `UnregisterNSObject (handle, this)` in the `Handle` setter, which only removes the `object_map` entry if it still refers to `this` (mirroring the check `NativeObjectHasDied` already had). * Add a native->managed ivar fallback to `Runtime.GetNSObject`/`GetNSObject<T>` so a user type whose object_map registration was deferred can still be resolved during `init`. * Gate both behaviors behind a legacy `AppContext` switch (`ObjCRuntime.Runtime.RegisterObjectsBeforeInit`, default off) to restore the previous behavior if any existing binding relied on it. Tests: * AllocInitRaceTest deterministically reproduces the clobber with a tiny custom native allocator (ReuseSlotClassA/ReuseSlotClassB): one class' `init` frees its instance and forces the next allocation to reuse that exact address. ReusedAddressSurvivesAllocInitClobber verifies the reused address still resolves to the correct object; ReusedAddressClobberedWithLegacySwitch documents the pre-fix behavior with the legacy switch on. * InitCallbackProbeTest exercises surfacing `self` to managed code during `init`. * A failed-init + GC guard (InitReturnsNilClass) covers the #23679 shape (a native `init` that raises an Objective-C exception, followed by a forced GC). Fixes #9478. Fixes #23679. Fixes #25861. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com>
Improve XML documentation for: - `PdfActionNamedName` - `PdfWidgetControlType` - `PdfLineStyle` - `PdfMarkupType` - `PdfTextAnnotationIconType` - `PdfBorderStyle` - `PdfDisplayBox` - `PdfDisplayMode` - `PdfAreaOfInterest` - `MKMapType` Each type is documented in a separate commit. The Cecil documentation baseline is updated for the newly documented `PdfMarkupType.Redact` and `PdfAreaOfInterest.AnyArea` APIs. 🤖 Pull request created by Copilot
) ErrorHelper.ShowInternal always logged through IToolLog.LogError, even for warnings. That was mostly harmless when the log was the console (the message text itself says "warning MTxxxx: ..."), but when the log is an MSBuild task - which is the case for the assembly preparer (the PrepareAssemblies task, used for NativeAOT) - every warning became an MSBuild error and failed the build. This made it impossible to build monotouch-test for macOS with NativeAOT, because the (correct) MT2387 warning about not being able to remove the dynamic registrar failed the build: error : warning MT2387: It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.RegisterAssembly (System.Reflection.Assembly)'. Use IToolLog.LogWarning for warnings instead, which each IToolLog implementation already handles correctly. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nion assembly for Hot Reload (#26410) The trimmable static registrar can relocate its registrar trampolines into a per-assembly companion assembly (`_<Asm>.TypeMap.dll`) so that user assemblies stay unmodified, which is a requirement for Hot Reload. Until now generic declaring types were excluded, because the existing implementation adds a proxy interface implementation to the user type - and that modifies the user assembly. This PR lifts that restriction. ## How it works For a method declared in a generic type we now emit a *generic* helper method into the companion assembly, mirroring the user type's generic parameters (including their constraints). Its body performs the same type-parameter-aware conversions as the regular trampoline, with the user type's generic parameters remapped to the helper method's own generic parameters. The static `UnmanagedCallersOnly` callback - which doesn't know the instance's generic arguments - boxes the native arguments into an `object []` and calls the new `Runtime.InvokeGenericRegistrarTrampoline`, which closes the helper over the instance's actual generic arguments (`MakeGenericMethod`) and invokes it. This path is only ever reachable in a Hot-Reload-compatible build, which always runs under the JIT, so `MakeGenericMethod` is safe; it's guarded with `Runtime.IsNativeAOT` so the linker folds it away (and elides the IL2060/IL3050 warnings) everywhere else. The closed helper is cached per (open helper method, closed instance type) in a nested type, so the reflection cost is paid once per instantiation, and so the `ConcurrentDictionary` instantiation is trimmed away together with the trampoline in every other configuration. ## Notable details | Detail | Why | |-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `out`/`ref` parameters | Pointer-typed native parameters can't be boxed into an `object []`, so they're represented as a plain `IntPtr` in the helper (same size, same native ABI). | | `exception_gchandle` | Reflection can't marshal an `IntPtr*`, so the helper takes an `out IntPtr` and the callback writes it back through the native pointer. | | Value-type returns | The helper returns `null` on failure, so the callback returns `default (T)` instead of unboxing `null` (which would throw across the `UnmanagedCallersOnly` boundary). | | `[DynamicDependency]` | The trimmer crashes when comparing a signature's parameter list against a method with a nested type parameter, so signatures now omit the parameter list when unambiguous. | The `[DynamicDependency]` change works around dotnet/runtime#131892. ## Tests * New assembly-preparer tests covering the relocated generic trampolines. * A new `Debug (trimmable static registrar, all optimizations)` test variation. This also fixes the existing `Release (trimmable static registrar, all optimizations)` variation, which was actually running a Debug build. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ixes #26288 (#26406) Simulator runtime downloads via `xcodebuild -downloadPlatform` in `system-dependencies.sh` occasionally fail with transient network errors during "Provision system dependencies", before any tests run. When the requested runtime isn't available through the normal mechanism, `xcodebuild` falls back to downloading it from Apple's downloadable simulator index, and that transport sometimes stalls until curl fails (e.g. `curl: (56) Recv failure: Operation timed out`). In that fallback case `xcodebuild` frequently still exits 0 while only printing the failure to stdout, so its exit code can't be trusted. This adds an `xcodebuild_download_platform` helper that retries the download up to 5 times (with a 15s delay between attempts). Rather than trusting `xcodebuild`'s exit code or parsing its output, it determines whether a download attempt succeeded by checking the desired result directly: is the simulator runtime actually installed and available afterwards (via `xcrun simctl list runtimes`)? This is the same kind of check already used in `check_old_simulators`. The helper is used for all three `-downloadPlatform` call sites. Fixes #26288 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
We've had a few regressions in mono-api-html, so this fixes the latest one and adds a unit test project to guard against future ones.
## The bug
The `MultiplexedFormatter` builds descriptions using the placeholder tokens `%LESSERTHANREPLACEMENT%` / `%GREATERTHANREPLACEMENT%`, because a single shared description string must be converted into each sub-formatter's own representation (`<`/`>` for HTML, `<`/`>` for markdown). The structured methods already convert these via `Replace ()`, but the raw `Write`/`WriteLine` string overloads did not.
The "New Type" addition path (`ClassComparer.AddedInner`) writes generic interface lists such as `IEnumerable<AuthorizationRight>` directly through `Output.Write`, so the placeholders leaked verbatim into the generated HTML (and markdown), e.g.:
IEnumerable%LESSERTHANREPLACEMENT%AuthorizationRight%GREATERTHANREPLACEMENT%
Applying `Replace ()` in the six string-based `Write`/`WriteLine` overloads converts the placeholders per sub-formatter on this path too.
## Tests & solution
* Added `tools/api-tools/mono-api-html-tests`, an NUnit test project that references `mono-api-html`. The first test drives the public `ApiDiffFormatted.Generate` over in-memory api-info XML (the exact `AuthorizationRights` case), producing both HTML and markdown, and asserts no `*THANREPLACEMENT` tokens leak and that the generic interface renders correctly in both formats. Verified the test fails without the fix.
* Added `tools/api-tools/api-tools.slnx` referencing `mono-api-info`, `mono-api-html` and the new test project, so `dotnet test` in `tools/api-tools` builds all three and runs the tests.
🤖 Pull request created by Copilot
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…gnatures. (#26418) The static registrar could emit method signatures referencing an Objective-C type whose framework header wasn't imported in the generated code, which made the generated code fail to compile: registrar.h:266:27: error: expected a type 266 | -(void) registerWebView:(WKWebView *)p0; | ^ This happened for a wrapper type from a binding project (Google.MobileAds' GADMobileAds) with a method taking a WebKit.WKWebView parameter, where nothing else in the app pulled in the WebKit framework: 'CheckNamespace' is only called for the types the registrar iterates over, not for the types showing up in the generated method signatures. Fix this by calling 'CheckNamespace' in 'ToObjCParameterType' for platform NSObject types, so that the corresponding '#import <Framework/Framework.h>' is always emitted. Copilot-Session: ddb2f938-9d62-4ccf-8ce8-70056d74178b --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Improve XML documentation for: - `AVAudioSessionSetActiveOptions` - `AVMusicTrackLoopCount` - `AVAudioSessionActivationOptions` - `SCNErrorCode` - `NSFileVersionReplacingOptions` - `NSFileVersionAddingOptions` - `NSItemProviderFileOptions` - `CVOptionFlags` - `CVTimeFlags` - `CVPixelBufferPoolFlushFlags` Each type is documented in a separate commit. The Cecil documentation baseline is updated for the newly documented `AVAudioSessionActivationOptions`, `SCNErrorCode`, and `NSItemProviderFileOptions` APIs. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This merge brings net11.0 up to date with main, including registrar/runtime fixes (notably for the alloc/init handle-reuse race in #25861), a new build-property-driven UI thread check mechanism, and several tooling/test improvements.
Changes:
- Update NSObject registration/unregistration and add deterministic regression tests for the alloc/init handle reuse race (#25861) and related init-time behaviors.
- Replace the legacy
remove-uithread-checksoptimization with theCheckForIllegalCrossThreadCallsMSBuild property + trimmer feature switch (including new tests and docs). - Improve trimmable-static registrar + Hot Reload support (generic trampoline relocation via companion helper + reflection) and harden DynamicDependency signature generation.
Reviewed changes
Copilot reviewed 74 out of 80 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tools/linker/OptimizeGeneratedCode.cs | Remove EnsureUIThread optimization pass |
| tools/dotnet-linker/Steps/TrimmableRegistrarStep.cs | Emit lookup method only when needed |
| tools/dotnet-linker/Steps/ManagedRegistrarStep.cs | Relocate generic trampolines for Hot Reload |
| tools/dotnet-linker/DocumentionComments.cs | Add name-only signature helper |
| tools/dotnet-linker/AppBundleRewriter.cs | Avoid trimmer crash in DynamicDependency signatures |
| tools/common/StaticRegistrar.cs | Add namespace validation in parameter mapping |
| tools/common/Optimizations.cs | Deprecate remove-uithread-checks optimization plumbing |
| tools/common/ErrorHelper.tools.cs | Don’t log warning stack traces as MSBuild errors |
| tools/api-tools/mono-api-html/MultiplexedFormatter.cs | Avoid placeholder leakage in output |
| tools/api-tools/mono-api-html-tests/mono-api-html-tests.csproj | New test project for mono-api-html |
| tools/api-tools/mono-api-html-tests/ApiDiffTests.cs | Regression test for placeholder leakage |
| tools/api-tools/api-tools.slnx | Add solution including tests |
| tests/xharness/Jenkins/TestVariationsFactory.cs | Adjust trimmable-static variation naming/coverage |
| tests/test-libraries/libtest.m | Add native helpers for init/race tests |
| tests/test-libraries/libtest.h | Expose native callbacks/types for new tests |
| tests/monotouch-test/ObjCRuntime/InitCallbackProbeTest.cs | Probe init-time behaviors for redesign |
| tests/monotouch-test/ObjCRuntime/AllocInitRaceTest.cs | Deterministic repro for #25861 (+ legacy switch test) |
| tests/linker/link all/PreserveTest.cs | Update preserved method signature expectation |
| tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt | Update preserved APIs baseline |
| tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt | Update preserved APIs baseline |
| tests/dotnet/UnitTests/expected/TVOS-CoreCLR-R2R-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/TVOS-CoreCLR-Interpreter-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-R2R-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-preservedapis.txt | Update preserved APIs baseline |
| tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-interpreter-preservedapis.txt | Update preserved APIs baseline |
| tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-R2R-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-Interpreter-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/iOS-MonoVM-preservedapis.txt | Update preserved APIs baseline |
| tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-preservedapis.txt | Update preserved APIs baseline |
| tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt | Update size baseline (TypeMap artifacts) |
| tests/dotnet/UnitTests/EnsureUIThreadChecksTest.cs | New test for CheckForIllegalCrossThreadCalls propagation |
| tests/dotnet/EnsureUIThreadApp/tvOS/EnsureUIThreadApp.csproj | New test app (tvOS) |
| tests/dotnet/EnsureUIThreadApp/shared.csproj | Shared test app config |
| tests/dotnet/EnsureUIThreadApp/macOS/EnsureUIThreadApp.csproj | New test app (macOS) |
| tests/dotnet/EnsureUIThreadApp/MacCatalyst/EnsureUIThreadApp.csproj | New test app (Mac Catalyst) |
| tests/dotnet/EnsureUIThreadApp/iOS/EnsureUIThreadApp.csproj | New test app (iOS) |
| tests/dotnet/EnsureUIThreadApp/EnsureUIThreadApp.cs | Reference EnsureUIThread for linker inspection |
| tests/dotnet/EnsureUIThreadApp/Directory.Build.props | Props passthrough for test app |
| tests/cecil-tests/Documentation.KnownFailures.txt | Remove resolved known failures |
| tests/bindings-test/ApiDefinition.cs | Add bindings for new native test types |
| tests/assembly-preparer/RelocateRegistrarTrampolinesTests.cs | Add test for generic relocation to companion |
| tests/assembly-preparer/PreserveSmartEnumConversionsTest.cs | Update DDA signature expectations |
| tests/assembly-preparer/PreserveBlockCodeHandlerTests.cs | Update DDA signature expectations |
| tests/assembly-preparer/OptimizeGeneratedCodeHandlerTests.cs | Remove EnsureUIThread optimizer tests + adjust others |
| tests/assembly-preparer/BaseClass.cs | Allow injecting extra csproj content |
| system-dependencies.sh | Retry/verify simulator runtime downloads |
| src/VideoSubscriberAccount/VSAccountProviderAuthenticationScheme.cs | Improve XML docs for smart-enum extensions |
| src/UIKit/UIApplication.cs | Move UI-thread check control to Runtime feature switch |
| src/SceneKit/Defs.cs | Improve docs for SCNErrorCode |
| src/SafariServices/SSEnums.cs | Improve docs for SSReadingListError |
| src/PdfKit/Enums.cs | Improve docs + add missing summaries |
| src/ObjCRuntime/TypeMaps.cs | Make LookupUnmanagedFunction virtual defaulting to Zero |
| src/ObjCRuntime/Runtime.cs | Add deferred registration + generic companion trampoline invoke |
| src/MapKit/MKEnums.cs | Fix doc typo |
| src/ILLink.Substitutions.tvOS.xml | Add feature switch + stub EnsureUIThread |
| src/ILLink.Substitutions.macOS.xml | Add feature switch + stub EnsureUIThread |
| src/ILLink.Substitutions.MacCatalyst.xml | Add feature switch + stub EnsureUIThread |
| src/ILLink.Substitutions.iOS.xml | Add feature switch + stub EnsureUIThread |
| src/Foundation/NSObject2.cs | Defer registration + ownership-aware unregister + ivar fallback |
| src/Foundation/Enum.cs | Improve docs + add NSItemProviderFileOptions docs |
| src/EventKitUI/Defs.cs | Improve docs for EventKitUI enums |
| src/CoreVideo/CVEnums.cs | Improve docs for CoreVideo enums |
| src/CoreTelephony/CTEnums.cs | Improve docs + add Cancel enum member doc |
| src/CoreMotion/Defs.cs | Remove placeholder docs |
| src/AVFoundation/Enums.cs | Improve docs + add AVAudioSessionActivationOptions docs |
| src/AppKit/NSApplication.cs | Align UI-thread checks with Runtime feature switch |
| dotnet/targets/Xamarin.Shared.Sdk.targets | Emit CheckForIllegalCrossThreadCalls feature switch |
| dotnet/targets/Xamarin.Shared.Sdk.props | Default trimmable-static for .NET 11 CoreCLR/NativeAOT |
| docs/website/optimizations.md | Document remove-uithread-checks replacement |
| docs/building-apps/build-properties.md | Document CheckForIllegalCrossThreadCalls |
| .github/workflows/zizmor.yml | Bump zizmor GitHub Action |
| if (onlyIfNeeded) { | ||
| if (object_map.ContainsKey (ptr)) { | ||
| // Already registered; don't touch the existing entry, just free the | ||
| // handle we speculatively allocated. | ||
| handle.Free (); | ||
| return; | ||
| } | ||
| } else { | ||
| if (object_map.Remove (ptr, out var existing)) | ||
| existing.Free (); | ||
| } |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #21edc1a] Prepare .NET Release succeeded ✅📦 Published NuGet packages (32 packages)iOS
MacCatalyst
macOS
tvOS
Other
Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…Dependency attributes.
The DynamicDependencyAttribute (string, Type) overload passed the TypeDefinition
straight to the custom attribute argument. When the type comes from a different
assembly than the one the attribute is added to, Cecil serializes the Type
argument without an assembly-qualified name (because a TypeDefinition's Scope is
its own module), and the trimmer can't resolve it:
ILLink : error IL2036: <Module>..cctor(): Unresolved type 'Foundation.NSExpression' in 'DynamicDependencyAttribute'.
This is exactly what the DynamicallyAccessedMemberTypes overload right below
already guards against, so do the same here: import the type into the current
assembly first.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b169a463-6209-484f-9a6a-cb4a0e13b000
This comment has been minimized.
This comment has been minimized.
ILLink's default assembly action is 'link', and the SDK only passes an explicit
'--action' to ILLink when $(TrimMode) is 'full' or 'partial'. This means that
with the legacy $(TrimMode)=link every assembly is linked, but the
assembly-preparer computed 'Copy' for any assembly without an
[AssemblyMetadata ("IsTrimmable", "true")] attribute.
Because of this mismatch every step whose IsActiveFor requires
AssemblyAction.Link (such as ApplyPreserveAttributeStep) skipped the app
assembly, so the [Preserve] attributes were never converted into
DynamicDependency attributes and the trimmer removed all the test fixtures.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b169a463-6209-484f-9a6a-cb4a0e13b000
…lue to the post-processing pass.
RegistrarRemovalTrackingStep runs in the assembly-preparer's preparation pass,
and the computed value is surfaced to MSBuild and used to set the
'ObjCRuntime.Runtime.DynamicRegistrationSupported' trimmer feature switch.
However, the native main file is generated during the post-processing pass
(GenerateMainStep), and that pass never got the computed value: it only got the
user-specified $(DynamicRegistrationSupported) MSBuild property (which is
usually empty). The result was that the native code was told that dynamic
registration was supported, while ILLink had removed the managed
implementation, and the app would crash at startup with:
The runtime function register_assembly has been linked away.
Fix this by passing the computed value to the post-processing pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b169a463-6209-484f-9a6a-cb4a0e13b000
RemoveAttributesStep only ran as a sub step of PostSweepDispatcher, and PostSweepDispatcher is gated out of the trimmer's custom steps when $(PrepareAssemblies) is true. The step had never been ported to the assembly-preparer, which meant that the [Preserve], [NativeName], [Adopts], [Protocol] and [ProtocolMember] attributes were never removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b169a463-6209-484f-9a6a-cb4a0e13b000
…to assemblies the trimmer removed.
The trimmable static registrar creates a companion typemap assembly for every
app assembly, and adds a corresponding TypeMapAssemblyTargetAttribute to the
root typemap assembly. If the trimmer ends up removing a companion assembly
(because all its types were trimmed away), the attribute in the root typemap
assembly is left behind (it's a plain string reference the trimmer knows
nothing about), and the app would crash at startup:
System.IO.FileNotFoundException: Could not load file or assembly '...TypeMap'
So add a new step that removes any such stale attributes.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b169a463-6209-484f-9a6a-cb4a0e13b000
…sed. PREPARE_ASSEMBLIES was only defined for the 'prepare-assemblies' test variation, but $(PrepareAssemblies) is now enabled by default in several configurations (CoreCLR + the trimmable static registrar), so tests that check the define would take the wrong code path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b169a463-6209-484f-9a6a-cb4a0e13b000
✅ 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 #7cfa209] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 31 tests failed, 233 tests passed. Failures❌ dotnettests tests (iOS)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (MacCatalyst)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (macOS)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ dotnettests tests (tvOS)1 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ introspection tests7 tests failed, 0 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (iOS)7 tests failed, 18 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (MacCatalyst)3 tests failed, 22 tests passed.Failed tests
Html Report (VSDrops) Download ❌ monotouch tests (tvOS)5 tests failed, 20 tests passed.Failed tests
Html Report (VSDrops) Download ❌ windows tests1 tests failed, 2 tests passed.Failed tests
Html Report (VSDrops) Download ❌ Tests on macOS Sonoma (14) tests1 tests failed, 4 tests passed.Failed tests
Html Report (VSDrops) Download ❌ Tests on macOS Sequoia (15) tests1 tests failed, 4 tests passed.Failed tests
Html Report (VSDrops) Download ❌ Tests on macOS Tahoe (26) tests2 tests failed, 3 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download macOS testsLinux Build VerificationPipeline on Agent |
|
No description provided.