From b89cd96887d959096c03eb6b1491f98a7fd8d9f2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 4 Aug 2026 19:02:18 +0200 Subject: [PATCH 01/23] [src] Add missing nullability to strongly-typed dictionary parameters (#26377) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several public APIs bind a native optional NSDictionary as a strongly-typed dictionary parameter, but the C# parameter itself was missing the `?` nullability annotation. In every case the code already handled null (via `param?.Dictionary`) and the underlying native API is `_Nullable` / `[NullAllowed]`, so the missing annotation was simply an oversight that surfaced unnecessary nullable-context warnings for callers passing `null`. Adding the annotation is not a breaking change: it only makes the parameter more permissive, so existing callers keep compiling. Fixed parameters: * `CGContextPDF.BeginTag` (`CGPdfTagProperties`) * `CIContext` constructor (`CIContextOptions`) * `CIImage.FromProvider` and the `CIImage` constructor (`CIImageProviderOptions`) * `UNNotificationAttachment.FromIdentifier` (`UNNotificationAttachmentOptions`) While here, the placeholder XML docs on these APIs were filled in (and the two `CGContextPDF.BeginTag` overloads, previously undocumented, were documented and dropped from the cecil-tests documentation known-failures list). I deliberately did not touch `CVPixelFormatDescription.Register`: its native API is `__nonnull` (the sibling `NSDictionary` overload throws on null), so its parameter is correctly non-nullable. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- src/CoreGraphics/CGContextPDF.cs | 12 +++++-- src/CoreImage/CIContext.cs | 7 ++-- src/CoreImage/CIImage.cs | 33 ++++++++++--------- .../UNNotificationAttachment.cs | 15 ++++----- .../Documentation.KnownFailures.txt | 2 -- 5 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/CoreGraphics/CGContextPDF.cs b/src/CoreGraphics/CGContextPDF.cs index af10c41c841e..721d2ab5cd30 100644 --- a/src/CoreGraphics/CGContextPDF.cs +++ b/src/CoreGraphics/CGContextPDF.cs @@ -414,21 +414,29 @@ public void SetDestination (string name, CGRect rect) [DllImport (Constants.CoreGraphicsLibrary)] static extern void CGPDFContextBeginTag (/* CGContextRef* */ IntPtr context, CGPdfTagType tagType, /* CFDictionaryRef* _Nullable */ IntPtr tagProperties); + /// Opens a tagged content sequence of the specified in the PDF context. + /// The type of the tag to open. + /// A dictionary of properties for the tag, or if there are none. + /// Every call to BeginTag must be balanced by a matching call to . [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst")] - public void BeginTag (CGPdfTagType tagType, NSDictionary tagProperties) + public void BeginTag (CGPdfTagType tagType, NSDictionary? tagProperties) { CGPDFContextBeginTag (Handle, tagType, tagProperties.GetHandle ()); GC.KeepAlive (tagProperties); } + /// Opens a tagged content sequence of the specified in the PDF context. + /// The type of the tag to open. + /// The properties for the tag, or if there are none. + /// Every call to BeginTag must be balanced by a matching call to . [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios13.0")] [SupportedOSPlatform ("tvos13.0")] [SupportedOSPlatform ("maccatalyst")] - public void BeginTag (CGPdfTagType tagType, CGPdfTagProperties tagProperties) + public void BeginTag (CGPdfTagType tagType, CGPdfTagProperties? tagProperties) { var d = tagProperties?.Dictionary; CGPDFContextBeginTag (Handle, tagType, d.GetHandle ()); diff --git a/src/CoreImage/CIContext.cs b/src/CoreImage/CIContext.cs index d0f845579dab..8e27dd19b554 100644 --- a/src/CoreImage/CIContext.cs +++ b/src/CoreImage/CIContext.cs @@ -72,14 +72,13 @@ public int? CIImageFormat { } public partial class CIContext { - /// The context options to use. - /// Creates a new Core Image context with the specified . - /// To be added. + /// Creates a new Core Image context with the specified . + /// The context options to use, or to use the default options. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("tvos")] - public CIContext (CIContextOptions options) : + public CIContext (CIContextOptions? options) : this (options?.Dictionary) { } diff --git a/src/CoreImage/CIImage.cs b/src/CoreImage/CIImage.cs index f26d20d4ec9d..e6cd5579bb1a 100644 --- a/src/CoreImage/CIImage.cs +++ b/src/CoreImage/CIImage.cs @@ -281,26 +281,27 @@ public static CIImage FromData (NSData bitmapData, nint bytesPerRow, CGSize size return FromData (bitmapData, bytesPerRow, size, CIImage.CIFormatToInt (pixelFormat), colorSpace); } - /// Creates a from an image provider with the specified dimensions, pixel format, and color space. - /// The image data provider. - /// The width of the image in pixels. - /// The height of the image in pixels. - /// The pixel format of the image data. - /// The color space for the resulting image. - /// Options that configure the image creation. - public static CIImage FromProvider (ICIImageProvider provider, nuint width, nuint height, CIFormat pixelFormat, CGColorSpace colorSpace, CIImageProviderOptions options) + /// Creates a new image that lazily obtains its data from the specified . + /// The provider that supplies the image data on demand. + /// The width of the image, in pixels. + /// The height of the image, in pixels. + /// The pixel format of the image data supplied by . + /// The color space of the image. + /// Options that control how the image is created, or to use the default options. + /// A new backed by . + public static CIImage FromProvider (ICIImageProvider provider, nuint width, nuint height, CIFormat pixelFormat, CGColorSpace colorSpace, CIImageProviderOptions? options) { return FromProvider (provider, width, height, CIImage.CIFormatToInt (pixelFormat), colorSpace, options?.Dictionary); } - /// Initializes a new from an image provider with the specified dimensions, pixel format, and color space. - /// The image data provider. - /// The width of the image in pixels. - /// The height of the image in pixels. - /// The pixel format of the image data. - /// The color space for the resulting image. - /// Options that configure the image creation. - public CIImage (ICIImageProvider provider, nuint width, nuint height, CIFormat pixelFormat, CGColorSpace colorSpace, CIImageProviderOptions options) + /// Creates a new image that lazily obtains its data from the specified . + /// The provider that supplies the image data on demand. + /// The width of the image, in pixels. + /// The height of the image, in pixels. + /// The pixel format of the image data supplied by . + /// The color space of the image. + /// Options that control how the image is created, or to use the default options. + public CIImage (ICIImageProvider provider, nuint width, nuint height, CIFormat pixelFormat, CGColorSpace colorSpace, CIImageProviderOptions? options) : this (provider, width, height, CIImage.CIFormatToInt (pixelFormat), colorSpace, options?.Dictionary) { } diff --git a/src/UserNotifications/UNNotificationAttachment.cs b/src/UserNotifications/UNNotificationAttachment.cs index 287871aee3bb..da4ad7f61a59 100644 --- a/src/UserNotifications/UNNotificationAttachment.cs +++ b/src/UserNotifications/UNNotificationAttachment.cs @@ -14,14 +14,13 @@ namespace UserNotifications { public partial class UNNotificationAttachment { - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. - public static UNNotificationAttachment? FromIdentifier (string identifier, NSUrl url, UNNotificationAttachmentOptions attachmentOptions, out NSError? error) + /// Creates a new attachment for a notification from the file at the specified . + /// The unique identifier for the attachment, or an empty string to have one generated automatically. + /// The URL of the file to attach. + /// Options that describe how the attachment should be handled, or to use the default options. + /// On failure, contains the error that describes why the attachment could not be created. + /// A new , or if the attachment could not be created. + public static UNNotificationAttachment? FromIdentifier (string identifier, NSUrl url, UNNotificationAttachmentOptions? attachmentOptions, out NSError? error) { return FromIdentifier (identifier, url, attachmentOptions?.Dictionary, out error); } diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index c0f46135f44a..e11221702fa4 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -9861,8 +9861,6 @@ M:CoreGraphics.CGContext.ShowTextAtPoint(System.Runtime.InteropServices.NFloat,S M:CoreGraphics.CGContext.ShowTextAtPoint(System.Runtime.InteropServices.NFloat,System.Runtime.InteropServices.NFloat,System.String) M:CoreGraphics.CGContext.StrokeRectWithWidth(CoreGraphics.CGRect,System.Runtime.InteropServices.NFloat) M:CoreGraphics.CGContext.TranslateCTM(System.Runtime.InteropServices.NFloat,System.Runtime.InteropServices.NFloat) -M:CoreGraphics.CGContextPDF.BeginTag(CoreGraphics.CGPdfTagType,CoreGraphics.CGPdfTagProperties) -M:CoreGraphics.CGContextPDF.BeginTag(CoreGraphics.CGPdfTagType,Foundation.NSDictionary) M:CoreGraphics.CGContextPDF.EndTag M:CoreGraphics.CGContextPDF.SetIdTree(CoreGraphics.CGPDFDictionary) M:CoreGraphics.CGContextPDF.SetPageTagStructureTree(Foundation.NSDictionary) From 16b31701f0a39046550fe953afeea6c6394525f6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 4 Aug 2026 19:02:29 +0200 Subject: [PATCH 02/23] [src] Convert manual binding factories to [FactoryMethod] (#26376) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convert five hand-written failable-initializer factory helpers to use the new bgen `[FactoryMethod]` attribute (added in #26196). Each conversion replaces an `[Internal] NativeHandle _InitWith...` helper plus a manual partial-class factory method with a `[FactoryMethod] [return: NullAllowed] NativeHandle Constructor (...)` in the binding definition, letting the generator emit the `public static T? Create (...)` factory. The manual partial-class files are deleted and their entries removed from `frameworks.sources`. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../AVSpeechSynthesisProviderAudioUnit.cs | 27 ------------- src/AVKit/AVCaptureEventSound.cs | 23 ----------- src/BackgroundAssets/BAAssetPackManifest.cs | 37 ------------------ .../SCVideoStreamAnalyzer.cs | 27 ------------- src/WebKit/WKWebExtensionMatchPattern.cs | 38 ------------------- src/avfoundation.cs | 10 ++++- src/avkit.cs | 9 ++++- src/backgroundassets.cs | 22 ++++++++--- src/frameworks.sources | 7 ---- src/sensitivecontentanalysis.cs | 10 ++++- src/webkit.cs | 24 +++++++++--- .../ConstructorTest.KnownFailures.cs | 2 - tests/cecil-tests/ConstructorTest.cs | 3 ++ .../TVOS-MonoVM-interpreter-preservedapis.txt | 4 +- .../expected/TVOS-MonoVM-preservedapis.txt | 4 +- 15 files changed, 66 insertions(+), 181 deletions(-) delete mode 100644 src/AVFoundation/AVSpeechSynthesisProviderAudioUnit.cs delete mode 100644 src/AVKit/AVCaptureEventSound.cs delete mode 100644 src/BackgroundAssets/BAAssetPackManifest.cs delete mode 100644 src/SensitiveContentAnalysis/SCVideoStreamAnalyzer.cs delete mode 100644 src/WebKit/WKWebExtensionMatchPattern.cs diff --git a/src/AVFoundation/AVSpeechSynthesisProviderAudioUnit.cs b/src/AVFoundation/AVSpeechSynthesisProviderAudioUnit.cs deleted file mode 100644 index 0b11ac58f3f5..000000000000 --- a/src/AVFoundation/AVSpeechSynthesisProviderAudioUnit.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using System.Threading.Tasks; - -using AudioUnit; - -#nullable enable - -namespace AVFoundation { - public partial class AVSpeechSynthesisProviderAudioUnit { - /// Create a new instance. - /// A description of the component to create. - /// Any options for the returned audio unit. - /// The error if an error occurred, null otherwise. - /// A new instance if successful, null otherwise. - public static AVSpeechSynthesisProviderAudioUnit? Create (AudioComponentDescription componentDescription, AudioComponentInstantiationOptions options, out NSError? error) - { - var rv = new AVSpeechSynthesisProviderAudioUnit (NSObjectFlag.Empty); - rv.InitializeHandle (rv._InitWithComponentDescription (componentDescription, options, out error), string.Empty, false); - if (rv.Handle == IntPtr.Zero) { - rv.Dispose (); - return null; - } - return rv; - } - } -} diff --git a/src/AVKit/AVCaptureEventSound.cs b/src/AVKit/AVCaptureEventSound.cs deleted file mode 100644 index 0e415a00eac1..000000000000 --- a/src/AVKit/AVCaptureEventSound.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Foundation; -using ObjCRuntime; - -namespace AVKit { -#if __IOS__ && !__MACCATALYST__ - public partial class AVCaptureEventSound { - /// Create a new instance for the specified . - /// The url for a local file from within the app bundle. - /// The error in case of failure. - /// A new instance if successful, otherwise will be an error for the failure. - public static AVCaptureEventSound? Create (NSUrl url, out NSError? error) - { - var rv = new AVCaptureEventSound (NSObjectFlag.Empty); - rv.InitializeHandle (rv._InitWithUrl (url, out error), "initWithURL:error:", false); - if (rv.Handle == NativeHandle.Zero) { - rv.Dispose (); - return null; - } - return rv; - } - } -#endif // __IOS__ && !__MACCATALYST__ -} diff --git a/src/BackgroundAssets/BAAssetPackManifest.cs b/src/BackgroundAssets/BAAssetPackManifest.cs deleted file mode 100644 index 2f80e2f20360..000000000000 --- a/src/BackgroundAssets/BAAssetPackManifest.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Foundation; - -namespace BackgroundAssets { - public partial class BAAssetPackManifest { - /// Create a new for the specified file on disk. - /// The url of the file on disk. The file is expected to be formatted as json. - /// The identifier for the application group where the downloaded assets will be stored. - /// The error if an error occurred. - /// A new if the operation succeeded, otherwise. - public static BAAssetPackManifest? Create (NSUrl url, string applicationGroupIdentifier, out NSError? error) - { - var rv = new BAAssetPackManifest (NSObjectFlag.Empty); - rv.InitializeHandle (rv._InitWithContentsOfUrl (url, applicationGroupIdentifier, out error), "initWithContentsOfURL:applicationGroupIdentifier:error:"); - if (rv.Handle == IntPtr.Zero) { - rv.Dispose (); - return null; - } - return rv; - } - - /// Create a new for the specified json data in memory. - /// The json data to use. - /// The identifier for the application group where the downloaded assets will be stored. - /// The error if an error occurred. - /// A new if the operation succeeded, otherwise. - public static BAAssetPackManifest? Create (NSData data, string applicationGroupIdentifier, out NSError? error) - { - var rv = new BAAssetPackManifest (NSObjectFlag.Empty); - rv.InitializeHandle (rv._InitFromData (data, applicationGroupIdentifier, out error), "initFromData:applicationGroupIdentifier:error:"); - if (rv.Handle == IntPtr.Zero) { - rv.Dispose (); - return null; - } - return rv; - } - } -} diff --git a/src/SensitiveContentAnalysis/SCVideoStreamAnalyzer.cs b/src/SensitiveContentAnalysis/SCVideoStreamAnalyzer.cs deleted file mode 100644 index a9ab2fe3f48d..000000000000 --- a/src/SensitiveContentAnalysis/SCVideoStreamAnalyzer.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using Foundation; -using ObjCRuntime; - -namespace SensitiveContentAnalysis { -#if __IOS__ && !__MACCATALYST__ - public partial class SCVideoStreamAnalyzer { - /// Creates a new instance with the specified participant and stream direction. - /// The unique identifier for a participant in the conference call. - /// Specifies whether the stream comes from the local camera or a remote location. - /// The error object if an error occurs. - /// A new instance with the specified participant and stream direction if successful; otherwise, . - public static SCVideoStreamAnalyzer? Create (string participantUuid, SCVideoStreamAnalyzerStreamDirection streamDirection, out NSError? error) - { - var rv = new SCVideoStreamAnalyzer (NSObjectFlag.Empty); - rv.InitializeHandle (rv._InitWithParticipantUuid (participantUuid, streamDirection, out error), "initWithParticipantUUID:streamDirection:error:", false); - if (rv.Handle == NativeHandle.Zero) { - rv.Dispose (); - return null; - } - return rv; - } - } -#endif // __IOS__ && !__MACCATALYST__ -} diff --git a/src/WebKit/WKWebExtensionMatchPattern.cs b/src/WebKit/WKWebExtensionMatchPattern.cs deleted file mode 100644 index 92626ca2f615..000000000000 --- a/src/WebKit/WKWebExtensionMatchPattern.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -namespace WebKit { - public partial class WKWebExtensionMatchPattern { - /// Create a new for the specified pattern. - /// The pattern to initialize the new instance with. - /// The error object, if an error occurred, otherwise null. - /// A newly created if successful, otherwise null. - public static WKWebExtensionMatchPattern? Create (string @string, out NSError? error) - { - var rv = new WKWebExtensionMatchPattern (NSObjectFlag.Empty); - rv.InitializeHandle (rv._InitWithString (@string, out error), string.Empty, false); - if (rv.Handle == IntPtr.Zero) { - rv.Dispose (); - return null; - } - return rv; - } - - /// Create a new for the specified scheme, host and path. - /// The scheme to initialize the new instance with. - /// The host to initialize the new instance with. - /// The path to initialize the new instance with. - /// The error object, if an error occurred, otherwise null. - /// A newly created if successful, otherwise null. - public static WKWebExtensionMatchPattern? Create (string scheme, string host, string path, out NSError? error) - { - var rv = new WKWebExtensionMatchPattern (NSObjectFlag.Empty); - rv.InitializeHandle (rv._InitWithScheme (scheme, host, path, out error), string.Empty, false); - if (rv.Handle == IntPtr.Zero) { - rv.Dispose (); - return null; - } - return rv; - } - } -} diff --git a/src/avfoundation.cs b/src/avfoundation.cs index d96079a74441..bd42540979cb 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -25924,10 +25924,16 @@ interface AVSpeechSynthesisMarker : NSSecureCoding, NSCopying { [DisableDefaultCtor] // introspection: Name: NSInvalidArgumentException Reason: Don't call -[AUAudioUnit init]. interface AVSpeechSynthesisProviderAudioUnit { // re-exposed from base class + /// Create a new instance. + /// A description of the component to create. + /// Any options for the returned audio unit. + /// The error if an error occurred, null otherwise. + /// A new instance if successful, null otherwise. [Export ("initWithComponentDescription:options:error:")] [DesignatedInitializer] - [Internal] - NativeHandle _InitWithComponentDescription (AudioComponentDescription componentDescription, AudioComponentInstantiationOptions options, [NullAllowed] out NSError outError); + [FactoryMethod] + [return: NullAllowed] + NativeHandle Constructor (AudioComponentDescription componentDescription, AudioComponentInstantiationOptions options, [NullAllowed] out NSError error); [Export ("speechVoices", ArgumentSemantic.Strong)] AVSpeechSynthesisProviderVoice [] SpeechVoices { get; set; } diff --git a/src/avkit.cs b/src/avkit.cs index 96f0660f68dd..f1cc59efa30c 100644 --- a/src/avkit.cs +++ b/src/avkit.cs @@ -1320,9 +1320,14 @@ interface IAVContinuityDevicePickerViewControllerDelegate { } [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface AVCaptureEventSound { + /// Create a new instance for the specified . + /// The url for a local file from within the app bundle. + /// The error in case of failure. + /// A new instance if successful, otherwise will be an error for the failure. [Export ("initWithURL:error:")] - [Internal] - NativeHandle _InitWithUrl (NSUrl url, [NullAllowed] out NSError error); + [FactoryMethod] + [return: NullAllowed] + NativeHandle Constructor (NSUrl url, [NullAllowed] out NSError error); [Static] [Export ("cameraShutterSound")] diff --git a/src/backgroundassets.cs b/src/backgroundassets.cs index 1ac895cd3907..668979d861c4 100644 --- a/src/backgroundassets.cs +++ b/src/backgroundassets.cs @@ -403,13 +403,25 @@ interface BAAssetPackManifest { [Export ("assetPacks", ArgumentSemantic.Copy)] NSSet AssetPacks { get; } - [Internal] + /// Create a new for the specified file on disk. + /// The url of the file on disk. The file is expected to be formatted as json. + /// The identifier for the application group where the downloaded assets will be stored. + /// The error if an error occurred. + /// A new if the operation succeeded, otherwise. + [FactoryMethod] [Export ("initWithContentsOfURL:applicationGroupIdentifier:error:")] - NativeHandle _InitWithContentsOfUrl (NSUrl url, string applicationGroupIdentifier, [NullAllowed] out NSError error); - - [Internal] + [return: NullAllowed] + NativeHandle Constructor (NSUrl url, string applicationGroupIdentifier, [NullAllowed] out NSError error); + + /// Create a new for the specified json data in memory. + /// The json data to use. + /// The identifier for the application group where the downloaded assets will be stored. + /// The error if an error occurred. + /// A new if the operation succeeded, otherwise. + [FactoryMethod] [Export ("initFromData:applicationGroupIdentifier:error:")] - NativeHandle _InitFromData (NSData data, string applicationGroupIdentifier, [NullAllowed] out NSError error); + [return: NullAllowed] + NativeHandle Constructor (NSData data, string applicationGroupIdentifier, [NullAllowed] out NSError error); [Export ("allDownloads")] NSSet GetAllDownloads (); diff --git a/src/frameworks.sources b/src/frameworks.sources index 17efc1375543..9dbe80bcc02e 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -283,7 +283,6 @@ AVFOUNDATION_SOURCES = \ AVFoundation/AVSampleCursor.cs \ AVFoundation/AVSpeechSynthesizer.cs \ AVFoundation/AVSpeechSynthesisMarker.cs \ - AVFoundation/AVSpeechSynthesisProviderAudioUnit.cs \ AVFoundation/AVSpeechUtterance.cs \ AVFoundation/AVTextStyleRule.cs \ AVFoundation/AVAssetTrack.cs \ @@ -301,7 +300,6 @@ AVKIT_API_SOURCES = \ AVKit/Enums.cs \ AVKIT_SOURCES = \ - AVKit/AVCaptureEventSound.cs \ AVKit/AVPlayerViewController.cs \ # AVRouting @@ -317,7 +315,6 @@ BACKGROUNDTASKS_API_SOURCES = \ # BackgroundAssets BACKGROUNDASSETS_SOURCES = \ - BackgroundAssets/BAAssetPackManifest.cs \ BackgroundAssets/BACompat.cs \ # BrowserEngineKit @@ -1616,9 +1613,6 @@ SECURITY_SOURCES = \ # SensitiveContentAnalysis -SENSITIVECONTENTANALYSIS_SOURCES = \ - SensitiveContentAnalysis/SCVideoStreamAnalyzer.cs \ - # SensorKit SENSORKIT_CORE_SOURCES = \ @@ -1864,7 +1858,6 @@ WEBKIT_SOURCES = \ WebKit/WKContentRuleListStore.cs \ WebKit/WKNavigationResponse.cs \ WebKit/WKPreferences.cs \ - WebKit/WKWebExtensionMatchPattern.cs \ WebKit/WKWindowFeatures.cs \ # diff --git a/src/sensitivecontentanalysis.cs b/src/sensitivecontentanalysis.cs index fe1bb8a40730..86a173b6ab9e 100644 --- a/src/sensitivecontentanalysis.cs +++ b/src/sensitivecontentanalysis.cs @@ -74,9 +74,15 @@ interface SCVideoStreamAnalyzer { [NullAllowed] SCVideoStreamAnalysisChangeHandler AnalysisChangedHandler { get; set; } + /// Creates a new instance with the specified participant and stream direction. + /// The unique identifier for a participant in the conference call. + /// Specifies whether the stream comes from the local camera or a remote location. + /// The error object if an error occurs. + /// A new instance with the specified participant and stream direction if successful; otherwise, . [Export ("initWithParticipantUUID:streamDirection:error:")] - [Internal] - NativeHandle _InitWithParticipantUuid (string participantUuid, SCVideoStreamAnalyzerStreamDirection streamDirection, [NullAllowed] out NSError error); + [FactoryMethod] + [return: NullAllowed] + NativeHandle Constructor (string participantUuid, SCVideoStreamAnalyzerStreamDirection streamDirection, [NullAllowed] out NSError error); [Export ("analyzePixelBuffer:")] void AnalyzePixelBuffer (CVPixelBuffer pixelBuffer); diff --git a/src/webkit.cs b/src/webkit.cs index 230a3d99c3d9..ee51fda4f166 100644 --- a/src/webkit.cs +++ b/src/webkit.cs @@ -8282,13 +8282,27 @@ interface WKWebExtensionMatchPattern : NSSecureCoding, NSCopying { [return: NullAllowed] WKWebExtensionMatchPattern Create (string scheme, string host, string path); + /// Create a new for the specified pattern. + /// The pattern to initialize the new instance with. + /// The error object, if an error occurred, otherwise null. + /// A newly created if successful, otherwise null. + [DesignatedInitializer] [Export ("initWithString:error:")] - [Internal] - NativeHandle _InitWithString (string @string, [NullAllowed] out NSError error); - + [FactoryMethod] + [return: NullAllowed] + NativeHandle Constructor (string @string, [NullAllowed] out NSError error); + + /// Create a new for the specified scheme, host and path. + /// The scheme to initialize the new instance with. + /// The host to initialize the new instance with. + /// The path to initialize the new instance with. + /// The error object, if an error occurred, otherwise null. + /// A newly created if successful, otherwise null. + [DesignatedInitializer] [Export ("initWithScheme:host:path:error:")] - [Internal] - NativeHandle _InitWithScheme (string scheme, string host, string path, [NullAllowed] out NSError error); + [FactoryMethod] + [return: NullAllowed] + NativeHandle Constructor (string scheme, string host, string path, [NullAllowed] out NSError error); [Export ("string")] string String { get; } diff --git a/tests/cecil-tests/ConstructorTest.KnownFailures.cs b/tests/cecil-tests/ConstructorTest.KnownFailures.cs index 2c99e33edb46..cab3001eba8d 100644 --- a/tests/cecil-tests/ConstructorTest.KnownFailures.cs +++ b/tests/cecil-tests/ConstructorTest.KnownFailures.cs @@ -60,8 +60,6 @@ public partial class ConstructorTest { "AVFoundation.AVAudioFile::.ctor(Foundation.NSUrl,AVFoundation.AudioSettings,AVFoundation.AVAudioCommonFormat,System.Boolean,Foundation.NSError&)", "AVFoundation.AVAudioFile::.ctor(Foundation.NSUrl,AVFoundation.AudioSettings,Foundation.NSError&)", "AVFoundation.AVAudioFile::.ctor(Foundation.NSUrl,AVFoundation.AVAudioCommonFormat,System.Boolean,Foundation.NSError&)", - "AVFoundation.AVAudioFile::.ctor(Foundation.NSUrl,Foundation.NSDictionary,AVFoundation.AVAudioCommonFormat,System.Boolean,Foundation.NSError&)", - "AVFoundation.AVAudioFile::.ctor(Foundation.NSUrl,Foundation.NSDictionary,Foundation.NSError&)", "AVFoundation.AVAudioFile::.ctor(Foundation.NSUrl,Foundation.NSError&)", "AVFoundation.AVCaptureDeviceInput::.ctor(AVFoundation.AVCaptureDevice,Foundation.NSError&)", "AVFoundation.AVMidiPlayer::.ctor(Foundation.NSData,Foundation.NSUrl,Foundation.NSError&)", diff --git a/tests/cecil-tests/ConstructorTest.cs b/tests/cecil-tests/ConstructorTest.cs index e8e13fc18598..382e016a6c7b 100644 --- a/tests/cecil-tests/ConstructorTest.cs +++ b/tests/cecil-tests/ConstructorTest.cs @@ -573,6 +573,9 @@ public void NoConstructorsWithOutErrorArguments () if (ctor.IsObsolete ()) continue; + if (!IsVisible (ctor)) + continue; + foreach (var param in ctor.Parameters) { if (param.ParameterType is not ByReferenceType) continue; diff --git a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt index 67d85bb1a3af..a688b83195db 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt @@ -177,7 +177,7 @@ Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Add(Foundation.NSObject Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Drain(Foundation.NSObject) Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.ScheduleDrain() Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2669_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2671_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::HasManagedRef Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::InitialSet @@ -1589,7 +1589,7 @@ Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(System.IntPtr, ObjCRuntime.IManagedRegistrar) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate.FinishedLaunching(UIKit.UIApplication, Foundation.NSDictionary) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__ -Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_359_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_361_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) Microsoft.tvOS.dll:UIKit.UIButton Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) diff --git a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt index 1913d56fe223..293552f23787 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt @@ -160,7 +160,7 @@ Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Add(Foundation.NSObject Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Drain(Foundation.NSObject) Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.ScheduleDrain() Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2669_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2671_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::HasManagedRef Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::InitialSet @@ -901,7 +901,7 @@ Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(System.IntPtr, ObjCRuntime.IManagedRegistrar) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate.FinishedLaunching(UIKit.UIApplication, Foundation.NSDictionary) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__ -Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_359_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_361_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) Microsoft.tvOS.dll:UIKit.UIButton Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) From b7caf07a390e36ff1b228dc97c2708a9dc336bf8 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 4 Aug 2026 19:03:44 +0200 Subject: [PATCH 03/23] [src] Generate remaining native constant accessors (#26367) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Express native constants for CFDictionary, CMTime, CMTimeRange, and cohesive analogous APIs as binding `[Field]` declarations instead of handwritten symbol-loading code. Extend bgen with narrowly scoped support for: - Native symbol addresses without pointer dereferencing. - Named partial struct extensions. - Required and optional unmanaged struct constants. Preserve existing API shape, platform availability, nullability, mutability, and missing-symbol behavior. Add focused bgen and static-initialization regression coverage. 🤖 Pull request created by Copilot --- docs/website/generator-errors.md | 2 + src/CoreAnimation/CAFrameRateRange.cs | 5 +- src/CoreFoundation/CFArray.cs | 11 +---- src/CoreFoundation/CFDictionary.cs | 16 +++---- src/CoreGraphics/CGRect.cs | 14 +----- src/CoreMedia/CMTime.cs | 28 ++++------- src/CoreMedia/CoreMedia.cs | 48 +++++-------------- src/CoreVideo/CVTime.cs | 14 ++---- src/Foundation/FieldAttribute.cs | 5 ++ src/MetalPerformanceShaders/MPSKernel.cs | 16 ------- src/Resources.Designer.cs | 9 ++++ src/Resources.resx | 4 ++ src/UIKit/UIListSeparatorConfiguration.cs | 29 ----------- src/UIKit/UITypes.cs | 25 ++++------ src/Vision/VNUtils.cs | 5 -- src/bgen/Generator.cs | 18 +++++-- src/coreanimation.cs | 7 +++ src/corefoundation.cs | 16 +++++++ src/coregraphics.cs | 10 ++++ src/coremedia.cs | 33 +++++++++++-- src/corevideo.cs | 12 +++++ src/frameworks.sources | 1 - src/metalperformanceshaders.cs | 4 ++ src/uikit.cs | 33 +++++++++++++ src/vision.cs | 4 ++ tests/bgen/BGenTests.cs | 21 ++++++++ tests/bgen/ErrorTests.cs | 22 +++++++++ tests/bgen/tests/native-field-generation.cs | 29 +++++++++++ .../Documentation.KnownFailures.txt | 3 -- tests/cecil-tests/Test.cs | 4 +- ...alyst-MonoVM-interpreter-preservedapis.txt | 8 +++- .../MacCatalyst-MonoVM-preservedapis.txt | 8 +++- ...reCLR-Interpreter-TrimmableStatic-size.txt | 14 +++--- .../MacOSX-CoreCLR-Interpreter-size.txt | 10 ++-- .../TVOS-MonoVM-interpreter-preservedapis.txt | 8 +++- .../expected/TVOS-MonoVM-preservedapis.txt | 8 +++- .../iOS-MonoVM-interpreter-preservedapis.txt | 8 +++- .../expected/iOS-MonoVM-preservedapis.txt | 8 +++- .../UnitTests/expected/iOS-MonoVM-size.txt | 8 ++-- .../MacCatalyst-UIKit.ignore | 3 -- .../common-CoreFoundation.ignore | 3 -- .../common-CoreMedia.ignore | 9 ---- .../common-CoreVideo.ignore | 2 - .../api-annotations-dotnet/iOS-UIKit.ignore | 3 -- 44 files changed, 319 insertions(+), 229 deletions(-) delete mode 100644 src/UIKit/UIListSeparatorConfiguration.cs create mode 100644 tests/bgen/tests/native-field-generation.cs diff --git a/docs/website/generator-errors.md b/docs/website/generator-errors.md index dafbbaa7d2a5..890847e65821 100644 --- a/docs/website/generator-errors.md +++ b/docs/website/generator-errors.md @@ -357,6 +357,8 @@ explicit name in the attribute is confusing and redundant. To fix this error, remove the method name from the `[FactoryMethod]` attribute, and rename the binding method if a different factory method name is desired. +### BI1128: The [Field] member '\*.\*' sets SymbolAddress, but its type is '\*'; only System.IntPtr is supported. + diff --git a/src/CoreAnimation/CAFrameRateRange.cs b/src/CoreAnimation/CAFrameRateRange.cs index 9a2fd6055007..124cc44755d7 100644 --- a/src/CoreAnimation/CAFrameRateRange.cs +++ b/src/CoreAnimation/CAFrameRateRange.cs @@ -2,6 +2,7 @@ #nullable enable namespace CoreAnimation { + /// Specifies minimum, maximum, and preferred frame rates. [SupportedOSPlatform ("tvos15.0")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios15.0")] @@ -24,8 +25,8 @@ public bool IsEqualTo (CAFrameRateRange other) => IsEqualTo (this, other) != 0; #if !COREBUILD - [Field ("CAFrameRateRangeDefault", "CoreAnimation")] - public static CAFrameRateRange Default => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreAnimation.Handle, "CAFrameRateRangeDefault"))!; + /// Gets the default frame-rate range. + public static CAFrameRateRange Default => CAFrameRateRangeFields.Default; #endif } diff --git a/src/CoreFoundation/CFArray.cs b/src/CoreFoundation/CFArray.cs index 152a60b0fce8..7a2185c5c193 100644 --- a/src/CoreFoundation/CFArray.cs +++ b/src/CoreFoundation/CFArray.cs @@ -54,16 +54,7 @@ internal CFArray (NativeHandle handle, bool owns) [DllImport (Constants.CoreFoundationLibrary, EntryPoint = "CFArrayGetTypeID")] internal extern static /* CFTypeID */ nint GetTypeID (); - // pointer to a const struct (REALLY APPLE?) - static IntPtr kCFTypeArrayCallbacks_ptr_value; - static IntPtr kCFTypeArrayCallbacks_ptr { - get { - // FIXME: right now we can't use [Fields] for GetIndirect - if (kCFTypeArrayCallbacks_ptr_value == IntPtr.Zero) - kCFTypeArrayCallbacks_ptr_value = Dlfcn.GetIndirect (Libraries.CoreFoundation.Handle, "kCFTypeArrayCallBacks"); - return kCFTypeArrayCallbacks_ptr_value; - } - } + static IntPtr kCFTypeArrayCallbacks_ptr = _CFTypeArrayCallbacks; internal static CFArray FromIntPtrs (params NativeHandle [] values) { diff --git a/src/CoreFoundation/CFDictionary.cs b/src/CoreFoundation/CFDictionary.cs index e2ed572f9709..4ac45f7a9b3f 100644 --- a/src/CoreFoundation/CFDictionary.cs +++ b/src/CoreFoundation/CFDictionary.cs @@ -32,9 +32,12 @@ namespace CoreFoundation { - class CFDictionary : NativeObject { - public static IntPtr KeyCallbacks; - public static IntPtr ValueCallbacks; + partial class CFDictionary : NativeObject { + /// The address of the Core Foundation callback table used for dictionary keys. + public static IntPtr KeyCallbacks = _KeyCallbacks; + + /// The address of the Core Foundation callback table used for dictionary values. + public static IntPtr ValueCallbacks = _ValueCallbacks; [Preserve (Conditional = true)] internal CFDictionary (NativeHandle handle, bool owns) @@ -45,13 +48,6 @@ internal CFDictionary (NativeHandle handle, bool owns) [DllImport (Constants.CoreFoundationLibrary, EntryPoint = "CFDictionaryGetTypeID")] public extern static nint GetTypeID (); - static CFDictionary () - { - var lib = Libraries.CoreFoundation.Handle; - KeyCallbacks = Dlfcn.GetIndirect (lib, "kCFTypeDictionaryKeyCallBacks"); - ValueCallbacks = Dlfcn.GetIndirect (lib, "kCFTypeDictionaryValueCallBacks"); - } - public static CFDictionary FromObjectAndKey (INativeObject obj, INativeObject key) { CFDictionary result = new CFDictionary (CFDictionaryCreate (IntPtr.Zero, new IntPtr [] { key.Handle }, new IntPtr [] { obj.Handle }, 1, KeyCallbacks, ValueCallbacks), true); diff --git a/src/CoreGraphics/CGRect.cs b/src/CoreGraphics/CGRect.cs index 16604ff59134..af996f599d55 100644 --- a/src/CoreGraphics/CGRect.cs +++ b/src/CoreGraphics/CGRect.cs @@ -42,20 +42,10 @@ public struct CGRect : IEquatable { #if !COREBUILD /// Gets an invalid, or null, rectangle. - /// To be added. - /// To be added. - [Field ("CGRectNull", "CoreGraphics")] // unused but helps xtro - public static CGRect Null { - get { return Dlfcn.GetCGRect (Libraries.CoreGraphics.Handle, "CGRectNull"); } - } + public static CGRect Null => CGRectFields.Null; /// Gets an infinitely large rectangle. - /// To be added. - /// To be added. - [Field ("CGRectInfinite", "CoreGraphics")] // unused but helps xtro - public static CGRect Infinite { - get { return Dlfcn.GetCGRect (Libraries.CoreGraphics.Handle, "CGRectInfinite"); } - } + public static CGRect Infinite => CGRectFields.Infinite; public static bool operator == (CGRect left, CGRect right) { diff --git a/src/CoreMedia/CMTime.cs b/src/CoreMedia/CMTime.cs index 9a4dfee63670..5bbb300ca6f6 100644 --- a/src/CoreMedia/CMTime.cs +++ b/src/CoreMedia/CMTime.cs @@ -14,7 +14,6 @@ namespace CoreMedia { /// A time value that represents a rational number /. - /// To be added. /// avcaptureframes [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] @@ -444,28 +443,17 @@ public static CMTime Fold (CMTime time, CMTimeRange foldRange) return CMTimeFoldIntoRange (time, foldRange); } - // FIXME: generated will need some changes to emit [Field] in partial struct (not class) /// Key that can be used in NSDictionary objects returned by CMTime to extract the Value property. - /// To be added. - public readonly static NSString? ValueKey; + public readonly static NSString? ValueKey = CMTimeFields.ValueKey; + /// Key that can be used in NSDictionary objects returned by CMTime to extract the Scale property. - /// To be added. - public readonly static NSString? ScaleKey; - /// To be added. - /// To be added. - public readonly static NSString? EpochKey; - /// To be added. - /// To be added. - public readonly static NSString? FlagsKey; + public readonly static NSString? ScaleKey = CMTimeFields.ScaleKey; - static CMTime () - { - var lib = Libraries.CoreMedia.Handle; - ValueKey = Dlfcn.GetStringConstant (lib, "kCMTimeValueKey"); - ScaleKey = Dlfcn.GetStringConstant (lib, "kCMTimeScaleKey"); - EpochKey = Dlfcn.GetStringConstant (lib, "kCMTimeEpochKey"); - FlagsKey = Dlfcn.GetStringConstant (lib, "kCMTimeFlagsKey"); - } + /// Key that can be used in NSDictionary objects returned by CMTime to extract the Epoch property. + public readonly static NSString? EpochKey = CMTimeFields.EpochKey; + + /// Key that can be used in NSDictionary objects returned by CMTime to extract the Flags property. + public readonly static NSString? FlagsKey = CMTimeFields.FlagsKey; [DllImport (Constants.CoreMediaLibrary)] extern static /* CFDictionaryRef */ IntPtr CMTimeCopyAsDictionary (CMTime time, /* CFAllocatorRef */ IntPtr allocator); diff --git a/src/CoreMedia/CoreMedia.cs b/src/CoreMedia/CoreMedia.cs index 25f1a349be19..fbed5cb25269 100644 --- a/src/CoreMedia/CoreMedia.cs +++ b/src/CoreMedia/CoreMedia.cs @@ -36,7 +36,6 @@ public struct CMSampleTimingInfo { // CMTimeRange.h /// A duration of time. - /// To be added. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -50,55 +49,34 @@ public struct CMTimeRange { /// To be added. public CMTime Duration; #if !COREBUILD - /// To be added. - /// To be added. - public static readonly CMTimeRange Zero; - /// To be added. - /// To be added. - public static readonly CMTimeRange InvalidRange; + /// Represents an empty time range starting at time zero. + public static readonly CMTimeRange Zero = CMTimeRangeFields.Zero; - /// To be added. - /// To be added. + /// Represents an invalid time range. + public static readonly CMTimeRange InvalidRange = CMTimeRangeFields.InvalidRange; + + /// Represents the invalid source range from the native invalid time mapping constant. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] - public static readonly CMTimeRange InvalidMapping; + public static readonly CMTimeRange InvalidMapping = CMTimeRangeFields.InvalidMapping; - /// To be added. - /// To be added. - /// To be added. + /// Gets the dictionary key for the source time range in a time mapping. + // initialized only once (see tests/cecil-tests/) [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] - public static NSString? TimeMappingSourceKey { get; private set; } + public static NSString? TimeMappingSourceKey { get; private set; } = CMTimeRangeFields.TimeMappingSourceKey; - /// To be added. - /// To be added. - /// To be added. + /// Gets the dictionary key for the target time range in a time mapping. + // initialized only once (see tests/cecil-tests/) [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("tvos")] - public static NSString? TimeMappingTargetKey { get; private set; } - - static CMTimeRange () - { - var lib = Libraries.CoreMedia.Handle; - var retZero = Dlfcn.dlsym (lib, "kCMTimeRangeZero"); - Zero = Marshal.PtrToStructure (retZero)!; - - var retInvalid = Dlfcn.dlsym (lib, "kCMTimeRangeInvalid"); - InvalidRange = Marshal.PtrToStructure (retInvalid)!; - - var retMappingInvalid = Dlfcn.dlsym (lib, "kCMTimeMappingInvalid"); - if (retMappingInvalid != IntPtr.Zero) - InvalidMapping = Marshal.PtrToStructure (retMappingInvalid)!; - - TimeMappingSourceKey = Dlfcn.GetStringConstant (lib, "kCMTimeMappingSourceKey"); - TimeMappingTargetKey = Dlfcn.GetStringConstant (lib, "kCMTimeMappingTargetKey"); - } + public static NSString? TimeMappingTargetKey { get; private set; } = CMTimeRangeFields.TimeMappingTargetKey; #endif // !COREBUILD } diff --git a/src/CoreVideo/CVTime.cs b/src/CoreVideo/CVTime.cs index e3d9cfc8c1fb..3f3716596b38 100644 --- a/src/CoreVideo/CVTime.cs +++ b/src/CoreVideo/CVTime.cs @@ -69,18 +69,10 @@ public struct CVTime { #if !COREBUILD /// Represents a zero duration. - public static CVTime ZeroTime { - get { - return Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVZeroTime"))!; - } - } + public static CVTime ZeroTime => CVTimeFields.ZeroTime; - /// Unknown or indefinite time. - public static CVTime IndefiniteTime { - get { - return Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.CoreVideo.Handle, "kCVIndefiniteTime"))!; - } - } + /// Represents an unknown or indefinite time. + public static CVTime IndefiniteTime => CVTimeFields.IndefiniteTime; #endif /// Determines whether two CVTime objects are equal. diff --git a/src/Foundation/FieldAttribute.cs b/src/Foundation/FieldAttribute.cs index 710fee8c3199..24bc578ec740 100644 --- a/src/Foundation/FieldAttribute.cs +++ b/src/Foundation/FieldAttribute.cs @@ -59,5 +59,10 @@ public FieldAttribute (string? symbolName, string libraryName) /// The library name where the global symbol is looked up from. /// The special name "__Internal" means that the symbol is looked up on the current executable. public string? LibraryName { get; set; } + + /// Gets or sets whether the generated accessor returns the address of the unmanaged symbol. + /// to return the symbol's address instead of the pointer stored at that address; otherwise, . + /// This property is only valid when the attributed member has type . + public bool SymbolAddress { get; set; } } } diff --git a/src/MetalPerformanceShaders/MPSKernel.cs b/src/MetalPerformanceShaders/MPSKernel.cs index 25c7b4f07590..75658ffdabfd 100644 --- a/src/MetalPerformanceShaders/MPSKernel.cs +++ b/src/MetalPerformanceShaders/MPSKernel.cs @@ -51,22 +51,6 @@ public static bool Supports (IMTLDevice device) return new float [3] { t [0], t [1], t [2] }; } - /// Gets a region that represents the default clipping rectangle. - /// To be added. - /// To be added. - [Field ("MPSRectNoClip", "MetalPerformanceShaders")] - public unsafe static MTLRegion RectNoClip { - get { - var p = Dlfcn.dlsym (Libraries.MetalPerformanceShaders.Handle, "MPSRectNoClip"); - if (p == IntPtr.Zero) - return new MTLRegion (); - unsafe { - nint* ptr = (nint*) p; - return MTLRegion.Create3D (ptr [0], ptr [1], ptr [2], ptr [3], ptr [4], ptr [5]); - } - } - } - [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] diff --git a/src/Resources.Designer.cs b/src/Resources.Designer.cs index 6786df44f32b..e164b7a932af 100644 --- a/src/Resources.Designer.cs +++ b/src/Resources.Designer.cs @@ -1221,5 +1221,14 @@ internal static string BI1127 { return ResourceManager.GetString("BI1127", resourceCulture); } } + + /// + /// Looks up a localized string similar to The [Field] member '{0}.{1}' sets SymbolAddress, but its type is '{2}'; only System.IntPtr is supported.. + /// + internal static string BI1128 { + get { + return ResourceManager.GetString("BI1128", resourceCulture); + } + } } } diff --git a/src/Resources.resx b/src/Resources.resx index 8ad2d4f20d74..a2c178569f00 100644 --- a/src/Resources.resx +++ b/src/Resources.resx @@ -652,4 +652,8 @@ The [FactoryMethod] attribute on '{0}.{1}' can't specify a method name when applied to a method that isn't a constructor. Remove the method name from the [FactoryMethod] attribute; the name of the binding method is used instead. + + + The [Field] member '{0}.{1}' sets SymbolAddress, but its type is '{2}'; only System.IntPtr is supported. + diff --git a/src/UIKit/UIListSeparatorConfiguration.cs b/src/UIKit/UIListSeparatorConfiguration.cs deleted file mode 100644 index 563411f936e4..000000000000 --- a/src/UIKit/UIListSeparatorConfiguration.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -// UIListSeparatorConfiguration.cs -// -// Authors: -// Alex Soto -// -// Copyright (c) Microsoft Corporation. -// - -#if IOS - -namespace UIKit { - public partial class UIListSeparatorConfiguration { - - static NSDirectionalEdgeInsets? automaticInsets = null; - public static NSDirectionalEdgeInsets AutomaticInsets { - get { - if (automaticInsets is null) { - var lib = Libraries.UIKit.Handle; - var ret = Dlfcn.dlsym (lib, "UIListSeparatorAutomaticInsets"); - automaticInsets = Marshal.PtrToStructure (ret)!; - } - - return automaticInsets.Value; - } - } - } -} -#endif // IOS diff --git a/src/UIKit/UITypes.cs b/src/UIKit/UITypes.cs index 6344da6240f8..23d59d7fcd60 100644 --- a/src/UIKit/UITypes.cs +++ b/src/UIKit/UITypes.cs @@ -227,37 +227,30 @@ public UIPointerAccessoryPosition (nfloat offset, nfloat angle) #if !COREBUILD /// The accessory position at the top. - [Field ("UIPointerAccessoryPositionTop", "UIKit")] - public static UIPointerAccessoryPosition Top => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionTop"))!; + public static UIPointerAccessoryPosition Top => UIPointerAccessoryPositionFields.Top; /// The accessory position at the top-right. - [Field ("UIPointerAccessoryPositionTopRight", "UIKit")] - public static UIPointerAccessoryPosition TopRight => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionTopRight"))!; + public static UIPointerAccessoryPosition TopRight => UIPointerAccessoryPositionFields.TopRight; /// The accessory position at the right. - [Field ("UIPointerAccessoryPositionRight", "UIKit")] - public static UIPointerAccessoryPosition Right => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionRight"))!; + public static UIPointerAccessoryPosition Right => UIPointerAccessoryPositionFields.Right; /// The accessory position at the bottom-right. - [Field ("UIPointerAccessoryPositionBottomRight", "UIKit")] - public static UIPointerAccessoryPosition BottomRight => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionBottomRight"))!; + public static UIPointerAccessoryPosition BottomRight => UIPointerAccessoryPositionFields.BottomRight; /// The accessory position at the bottom. - [Field ("UIPointerAccessoryPositionBottom", "UIKit")] - public static UIPointerAccessoryPosition Bottom => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionBottom"))!; + public static UIPointerAccessoryPosition Bottom => UIPointerAccessoryPositionFields.Bottom; /// The accessory position at the bottom-left. - [Field ("UIPointerAccessoryPositionBottomLeft", "UIKit")] - public static UIPointerAccessoryPosition BottomLeft => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionBottomLeft"))!; + public static UIPointerAccessoryPosition BottomLeft => UIPointerAccessoryPositionFields.BottomLeft; /// The accessory position at the left. - [Field ("UIPointerAccessoryPositionLeft", "UIKit")] - public static UIPointerAccessoryPosition Left => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionLeft"))!; + public static UIPointerAccessoryPosition Left => UIPointerAccessoryPositionFields.Left; /// The accessory position at the top-left. - [Field ("UIPointerAccessoryPositionTopLeft", "UIKit")] - public static UIPointerAccessoryPosition TopLeft => Marshal.PtrToStructure (Dlfcn.GetIndirect (Libraries.UIKit.Handle, "UIPointerAccessoryPositionTopLeft"))!; + public static UIPointerAccessoryPosition TopLeft => UIPointerAccessoryPositionFields.TopLeft; #endif + } #endif diff --git a/src/Vision/VNUtils.cs b/src/Vision/VNUtils.cs index 8f1cd862dd4d..76f5c710aceb 100644 --- a/src/Vision/VNUtils.cs +++ b/src/Vision/VNUtils.cs @@ -20,11 +20,6 @@ namespace Vision { [SupportedOSPlatform ("maccatalyst")] public static partial class VNUtils { - // initialized only once (see tests/cecil-tests/) - /// Gets the normalized identity [0, 0, 1, 1]. - [Field ("VNNormalizedIdentityRect", Constants.VisionLibrary)] - public static CGRect NormalizedIdentityRect { get; } = Dlfcn.GetCGRect (Libraries.Vision.Handle, "VNNormalizedIdentityRect"); - [DllImport (Constants.VisionLibrary, EntryPoint = "VNNormalizedRectIsIdentityRect")] static extern byte _IsIdentityRect (CGRect rect); diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 622464415f96..636ccab43f2f 100644 --- a/src/bgen/Generator.cs +++ b/src/bgen/Generator.cs @@ -6614,6 +6614,10 @@ public void Generate (Type type) if (field_exports.Count != 0) { foreach (var field_pi in field_exports.OrderBy (f => f.Name, StringComparer.Ordinal)) { var fieldAttr = AttributeManager.GetCustomAttribute (field_pi); + if (fieldAttr?.SymbolAddress == true && field_pi.PropertyType != TypeCache.System_IntPtr) { + exceptions.Add (ErrorHelper.CreateError (1128, type.FullName, field_pi.Name, field_pi.PropertyType.FullName)); + continue; + } if (!TryComputeLibraryName (fieldAttr?.LibraryName, type, out var library_name, out var library_path)) { exceptions.Add (ErrorHelper.CreateError (1042, /* Missing '[Field (LibraryName=value)]' for {0} (e.g."__Internal") */ type.FullName + "." + field_pi.Name)); continue; @@ -6728,7 +6732,7 @@ public void Generate (Type type) } PrintAttributes (field_pi, preserve: true, advice: true); PrintObsoleteAttributes (field_pi); - print ("[Field (\"{0}\", \"{1}\")]", fieldAttr!.SymbolName, library_path ?? library_name); + print ("[Field (\"{0}\", \"{1}\"{2})]", fieldAttr!.SymbolName, library_path ?? library_name, fieldAttr.SymbolAddress ? ", SymbolAddress = true" : ""); PrintPlatformAttributes (field_pi); if (AttributeManager.HasAttribute (field_pi)) { print ("[EditorBrowsable (EditorBrowsableState.Advanced)]"); @@ -6788,7 +6792,10 @@ public void Generate (Type type) } else if (field_pi.PropertyType == TypeCache.System_Float) { print ("return Dlfcn.GetFloat (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_IntPtr) { - print ("return Dlfcn.GetIntPtr (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); + if (fieldAttr.SymbolAddress) + print ("return Dlfcn.GetIndirect (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); + else + print ("return Dlfcn.GetIntPtr (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_UIntPtr) { print ("return Dlfcn.GetUIntPtr (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_Int64) { @@ -6801,8 +6808,8 @@ public void Generate (Type type) // if (Frameworks.HaveCoreMedia && Frameworks.HaveAVFoundation && (field_pi.PropertyType == TypeCache.CMTime || field_pi.PropertyType == TypeCache.AVCaptureWhiteBalanceGains)) { - print ("return *(({3} *) Dlfcn.dlsym (Libraries.{2}.Handle, \"{1}\"));", field_pi.Name, fieldAttr.SymbolName, library_name, - TypeManager.FormatType (type, field_pi.PropertyType.Namespace, field_pi.PropertyType.Name)); + var valueTypeName = TypeManager.FormatType (type, field_pi.PropertyType.Namespace, field_pi.PropertyType.Name); + print ("return Dlfcn.GetStruct<{3}> (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name, valueTypeName); } else if (field_pi.PropertyType == TypeCache.System_nint) { print ("return Dlfcn.GetNInt (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name); } else if (field_pi.PropertyType == TypeCache.System_nuint) { @@ -6842,6 +6849,9 @@ public void Generate (Type type) else throw new BindingException (1014, true, fieldTypeName, FormatPropertyInfo (field_pi)); } + } else if (field_pi.PropertyType.IsValueType) { + var valueTypeName = TypeManager.FormatType (type, field_pi.PropertyType.Namespace, field_pi.PropertyType.Name); + print ("return Dlfcn.GetStruct<{3}> (Libraries.{2}.Handle, \"{1}\");", field_pi.Name, fieldAttr.SymbolName, library_name, valueTypeName); } else { if (field_pi.PropertyType == TypeCache.System_String) throw new BindingException (1013, true); diff --git a/src/coreanimation.cs b/src/coreanimation.cs index 4ac80ab97faf..bbda6a0e95a5 100644 --- a/src/coreanimation.cs +++ b/src/coreanimation.cs @@ -58,6 +58,13 @@ namespace CoreAnimation { + [Static] + [Internal] + interface CAFrameRateRangeFields { + [Field ("CAFrameRateRangeDefault", "CoreAnimation")] + CAFrameRateRange Default { get; } + } + /// Provides a hierarchical timing system, with support for repetition and sequencing. /// /// Apple documentation for CAMediaTiming diff --git a/src/corefoundation.cs b/src/corefoundation.cs index 98038f7d3bf4..312a54184c50 100644 --- a/src/corefoundation.cs +++ b/src/corefoundation.cs @@ -37,6 +37,22 @@ interface CFArray { [Internal] [Field ("kCFNull")] IntPtr /* CFNullRef */ _CFNullHandle { get; } + + [Internal] + [Field ("kCFTypeArrayCallBacks", SymbolAddress = true)] + IntPtr _CFTypeArrayCallbacks { get; } + } + + [Internal] + [Partial] + interface CFDictionary { + [Internal] + [Field ("kCFTypeDictionaryKeyCallBacks", SymbolAddress = true)] + IntPtr _KeyCallbacks { get; } + + [Internal] + [Field ("kCFTypeDictionaryValueCallBacks", SymbolAddress = true)] + IntPtr _ValueCallbacks { get; } } [Static, Partial] diff --git a/src/coregraphics.cs b/src/coregraphics.cs index ce7b6b48f93e..e43ae82fc306 100644 --- a/src/coregraphics.cs +++ b/src/coregraphics.cs @@ -6,6 +6,16 @@ namespace CoreGraphics { + [Static] + [Internal] + interface CGRectFields { + [Field ("CGRectNull", "CoreGraphics")] + CGRect Null { get; } + + [Field ("CGRectInfinite", "CoreGraphics")] + CGRect Infinite { get; } + } + [TV (18, 0), Mac (15, 0), iOS (18, 0), MacCatalyst (18, 0)] enum CGToneMapping : uint { Default = 0, diff --git a/src/coremedia.cs b/src/coremedia.cs index f35a6484d9ba..602cfa8a2e94 100644 --- a/src/coremedia.cs +++ b/src/coremedia.cs @@ -1070,23 +1070,46 @@ interface CMHevcTemporalLevelInfoSettings { int LevelIndex { get; set; } } -#if false - // right now the generator can't add fields in a partial struct - [Partial] - interface CMTime { + [Static] + [Internal] + interface CMTimeFields { [Field ("kCMTimeValueKey")] + [NullAllowed] NSString ValueKey { get; } [Field ("kCMTimeScaleKey")] + [NullAllowed] NSString ScaleKey { get; } [Field ("kCMTimeEpochKey")] + [NullAllowed] NSString EpochKey { get; } [Field ("kCMTimeFlagsKey")] + [NullAllowed] NSString FlagsKey { get; } } -#endif + + [Static] + [Internal] + interface CMTimeRangeFields { + [Field ("kCMTimeRangeZero")] + CMTimeRange Zero { get; } + + [Field ("kCMTimeRangeInvalid")] + CMTimeRange InvalidRange { get; } + + [Field ("kCMTimeMappingInvalid")] + CMTimeRange InvalidMapping { get; } + + [Field ("kCMTimeMappingSourceKey")] + [NullAllowed] + NSString TimeMappingSourceKey { get; } + + [Field ("kCMTimeMappingTargetKey")] + [NullAllowed] + NSString TimeMappingTargetKey { get; } + } [Flags] [TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)] diff --git a/src/corevideo.cs b/src/corevideo.cs index 77146ca67090..5131249f6ced 100644 --- a/src/corevideo.cs +++ b/src/corevideo.cs @@ -10,6 +10,18 @@ namespace CoreVideo { + struct CVTime { } + + [Static] + [Internal] + interface CVTimeFields { + [Field ("kCVZeroTime")] + CVTime ZeroTime { get; } + + [Field ("kCVIndefiniteTime")] + CVTime IndefiniteTime { get; } + } + /// Manages pixel buffer pool allocation settings. [Partial] interface CVPixelBufferPoolAllocationSettings { diff --git a/src/frameworks.sources b/src/frameworks.sources index 9dbe80bcc02e..79ee976e2080 100644 --- a/src/frameworks.sources +++ b/src/frameworks.sources @@ -1747,7 +1747,6 @@ UIKIT_SOURCES = \ UIKit/UIImagePickerController.cs \ UIKit/UIKeyboard.cs \ UIKit/UIKitSynchronizationContext.cs \ - UIKit/UIListSeparatorConfiguration.cs \ UIKit/UIMenu.cs \ UIKit/UINavigationBar.cs \ UIKit/UINavigationController.cs \ diff --git a/src/metalperformanceshaders.cs b/src/metalperformanceshaders.cs index ea58911f66e9..adf540d01fd9 100644 --- a/src/metalperformanceshaders.cs +++ b/src/metalperformanceshaders.cs @@ -1205,6 +1205,10 @@ interface MPSImageThresholdToZeroInverse { [BaseType (typeof (NSObject))] [DisableDefaultCtor] interface MPSKernel : NSCopying, NSSecureCoding { + /// Gets a region that represents the default clipping rectangle. + [Field ("MPSRectNoClip")] + MTLRegion RectNoClip { get; } + /// The unarchiver object. /// To be added. /// A constructor that initializes the object from the data stored in the unarchiver object. diff --git a/src/uikit.cs b/src/uikit.cs index 7f66a8eb247c..15b611969906 100644 --- a/src/uikit.cs +++ b/src/uikit.cs @@ -34244,6 +34244,10 @@ public enum UIListSeparatorVisibility : long { [DisableDefaultCtor] interface UIListSeparatorConfiguration : NSCopying, NSSecureCoding { + /// Gets the automatic directional edge insets for a list separator. + [Field ("UIListSeparatorAutomaticInsets")] + NSDirectionalEdgeInsets AutomaticInsets { get; } + [Export ("initWithListAppearance:")] [DesignatedInitializer] NativeHandle Constructor (UICollectionLayoutListAppearance listAppearance); @@ -34271,6 +34275,35 @@ interface UIListSeparatorConfiguration : NSCopying, NSSecureCoding { UIVisualEffect VisualEffect { get; set; } } + [NoTV, NoMac, iOS (15, 0), MacCatalyst (15, 0)] + [Static] + [Internal] + interface UIPointerAccessoryPositionFields { + [Field ("UIPointerAccessoryPositionTop")] + UIPointerAccessoryPosition Top { get; } + + [Field ("UIPointerAccessoryPositionTopRight")] + UIPointerAccessoryPosition TopRight { get; } + + [Field ("UIPointerAccessoryPositionRight")] + UIPointerAccessoryPosition Right { get; } + + [Field ("UIPointerAccessoryPositionBottomRight")] + UIPointerAccessoryPosition BottomRight { get; } + + [Field ("UIPointerAccessoryPositionBottom")] + UIPointerAccessoryPosition Bottom { get; } + + [Field ("UIPointerAccessoryPositionBottomLeft")] + UIPointerAccessoryPosition BottomLeft { get; } + + [Field ("UIPointerAccessoryPositionLeft")] + UIPointerAccessoryPosition Left { get; } + + [Field ("UIPointerAccessoryPositionTopLeft")] + UIPointerAccessoryPosition TopLeft { get; } + } + [NoTV, iOS (14, 5)] [MacCatalyst (14, 5)] [BaseType (typeof (NSObject))] diff --git a/src/vision.cs b/src/vision.cs index 526455d88c70..de9ff029b499 100644 --- a/src/vision.cs +++ b/src/vision.cs @@ -27,6 +27,10 @@ namespace Vision { interface VNUtils { [Field ("VNVisionVersionNumber")] double VisionVersionNumber { get; } + + /// Gets the normalized identity [0, 0, 1, 1]. + [Field ("VNNormalizedIdentityRect")] + CGRect NormalizedIdentityRect { get; } } /// Enumerates errors associated with Vision requests. diff --git a/tests/bgen/BGenTests.cs b/tests/bgen/BGenTests.cs index 4e3366940da5..8e76f606f6c6 100644 --- a/tests/bgen/BGenTests.cs +++ b/tests/bgen/BGenTests.cs @@ -1769,6 +1769,27 @@ public void FieldNullability (Profile profile) Assert.That (contents, Does.Contain ("public static NSString NonNullableString"), "Non-nullable field"); } + [Test] + [TestCase (Profile.iOS)] + public void NativeFieldGeneration (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = BuildFile (profile, "native-field-generation.cs"); + + var structFile = Path.Combine (bgen.TmpDirectory!, "NativeFieldGeneration", "NativeStructFields.g.cs"); + Assert.That (File.Exists (structFile), Is.True, "Generated struct file exists"); + var structContents = File.ReadAllText (structFile); + Assert.That (structContents, Does.Contain ("internal unsafe static partial class NativeStructFields"), "Internal field container"); + Assert.That (structContents, Does.Contain ("return Dlfcn.GetStruct (Libraries.__Internal.Handle, \"RequiredStruct\");"), "Struct"); + Assert.That (structContents, Does.Contain ("public static NSString? NullableString"), "Nullable field"); + + var addressFile = Path.Combine (bgen.TmpDirectory!, "NativeFieldGeneration", "SymbolAddresses.g.cs"); + Assert.That (File.Exists (addressFile), Is.True, "Generated address file exists"); + var addressContents = File.ReadAllText (addressFile); + Assert.That (addressContents, Does.Contain ("[Field (\"CallbackTable\", \"__Internal\", SymbolAddress = true)]"), "Symbol address attribute"); + Assert.That (addressContents, Does.Contain ("return Dlfcn.GetIndirect (Libraries.__Internal.Handle, \"CallbackTable\");"), "Symbol address"); + } + [Test] [TestCase (Profile.iOS)] [TestCase (Profile.tvOS)] diff --git a/tests/bgen/ErrorTests.cs b/tests/bgen/ErrorTests.cs index 4a55e9785c74..da0327a93d70 100644 --- a/tests/bgen/ErrorTests.cs +++ b/tests/bgen/ErrorTests.cs @@ -531,6 +531,28 @@ interface FooObject { bgen.AssertError (1014, "Unsupported type for Fields: byte[] for 'Bug57094.FooObject SomeField'."); } + [Test] + [TestCase (Profile.iOS)] + public void BI1128 (Profile profile) + { + Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ()); + var bgen = new BGenTool (); + bgen.Profile = profile; + bgen.CreateTemporaryBinding (@" +using Foundation; + +namespace BI1128Tests { + + [Static] + interface FieldConstants { + [Field (""InvalidSymbolAddress"", ""__Internal"", SymbolAddress = true)] + int InvalidSymbolAddress { get; } + } +}"); + bgen.AssertExecuteError ("build"); + bgen.AssertError (1128, "The [Field] member 'BI1128Tests.FieldConstants.InvalidSymbolAddress' sets SymbolAddress, but its type is 'System.Int32'; only System.IntPtr is supported."); + } + [Test] [TestCase (Profile.iOS)] public void BI1062_NoAsyncMethodRefHandlerTest (Profile profile) diff --git a/tests/bgen/tests/native-field-generation.cs b/tests/bgen/tests/native-field-generation.cs new file mode 100644 index 000000000000..ca9f8145ddf2 --- /dev/null +++ b/tests/bgen/tests/native-field-generation.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +#nullable enable + +using System; + +using CoreGraphics; +using Foundation; + +namespace NativeFieldGeneration { + + [Static] + [Internal] + interface NativeStructFields { + [Field ("RequiredStruct", "__Internal")] + CGRect Required { get; } + + [Field ("NullableString", "__Internal")] + [NullAllowed] + NSString NullableString { get; } + } + + [Partial] + interface SymbolAddresses { + [Field ("CallbackTable", "__Internal", SymbolAddress = true)] + IntPtr CallbackTable { get; } + } +} diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index e11221702fa4..9d658fa630c1 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -17188,7 +17188,6 @@ P:CoreAnimation.CAConstraint.Offset P:CoreAnimation.CADisplayLink.PreferredFrameRateRange P:CoreAnimation.CAEdrMetadata.Available P:CoreAnimation.CAEdrMetadata.HlgMetadata -P:CoreAnimation.CAFrameRateRange.Default P:CoreAnimation.CAGradientLayer.WeakLayerType P:CoreAnimation.CALayer.ContentsHeadroom P:CoreAnimation.CALayer.CornerCurve @@ -21793,7 +21792,6 @@ P:UIKit.UIIndirectScribbleInteraction.HandlingWriting P:UIKit.UILargeContentViewerInteraction.Delegate P:UIKit.UILargeContentViewerInteraction.Enabled P:UIKit.UIListContentView.ListContentConfiguration -P:UIKit.UIListSeparatorConfiguration.AutomaticInsets P:UIKit.UIMenu.Identifier P:UIKit.UIMenu.SelectedElements P:UIKit.UIMenuController.MenuVisible @@ -23460,7 +23458,6 @@ T:CoreAnimation.CACornerCurve T:CoreAnimation.CACornerMask T:CoreAnimation.CADynamicRange T:CoreAnimation.CAEdrMetadata -T:CoreAnimation.CAFrameRateRange T:CoreAnimation.CAGradientLayerType T:CoreAnimation.CAMetalDisplayLink T:CoreAnimation.CAMetalDisplayLinkUpdate diff --git a/tests/cecil-tests/Test.cs b/tests/cecil-tests/Test.cs index a85f755871cf..2883f28a432d 100644 --- a/tests/cecil-tests/Test.cs +++ b/tests/cecil-tests/Test.cs @@ -37,8 +37,8 @@ public void IdentifyBackingFieldAssignation (AssemblyInfo info) if (name == "k__BackingField") break; goto default; - case "Vision.VNUtils": - if (name == "k__BackingField") + case "CoreMedia.CMTimeRange": + if (name == "k__BackingField" || name == "k__BackingField") break; goto default; default: diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-interpreter-preservedapis.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-interpreter-preservedapis.txt index e32acb591e2d..abfe5bfd0ef1 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-interpreter-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-interpreter-preservedapis.txt @@ -23,11 +23,12 @@ Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRunti Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/<>O -Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.MacCatalyst.dll:CoreFoundation.CFObject Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -358,6 +359,7 @@ Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.D Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -1292,7 +1294,7 @@ Microsoft.MacCatalyst.dll:System.Collections.Generic.List`1k__BackingField Microsoft.MacCatalyst.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary/d__66::<>7__wrap2 @@ -1321,6 +1323,8 @@ Microsoft.MacCatalyst.dll:System.Int32 Registrar.Registrar/ObjCField::Size Microsoft.MacCatalyst.dll:System.Int32 Registrar.Trampoline::value__ Microsoft.MacCatalyst.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.MacCatalyst.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-preservedapis.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-preservedapis.txt index 0c1d54b42953..65a4b6d3680d 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-preservedapis.txt @@ -18,11 +18,12 @@ Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRunti Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/<>O -Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.MacCatalyst.dll:CoreFoundation.CFObject Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -270,6 +271,7 @@ Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.D Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -691,7 +693,7 @@ Microsoft.MacCatalyst.dll:System.Collections.Generic.List`1 ObjCR Microsoft.MacCatalyst.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.MacCatalyst.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary/d__66::<>7__wrap2 @@ -714,6 +716,8 @@ Microsoft.MacCatalyst.dll:System.Int32 ObjCRuntime.RuntimeException::k__Ba Microsoft.MacCatalyst.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.MacCatalyst.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.MacCatalyst.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt index 497566949808..3b5bd4555ebf 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt @@ -1,17 +1,17 @@ -AppBundleSize: 257,724,211 bytes (251,683.8 KB = 245.8 MB) +AppBundleSize: 257,737,625 bytes (251,696.9 KB = 245.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 718 bytes (0.7 KB = 0.0 MB) + 756 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 7,386,728 bytes (7,213.6 KB = 7.0 MB) + 7,387,816 bytes (7,214.7 KB = 7.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/_Microsoft.macOS.TypeMap.dll: 4,911,616 bytes (4,796.5 KB = 4.7 MB) Contents/MonoBundle/.xamarin/osx-arm64/_SizeTestApp.TypeMap.dll: - 3,072 bytes (3.0 KB = 0.0 MB) + 3,584 bytes (3.5 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.CSharp.dll: 892,712 bytes (871.8 KB = 0.9 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.macOS.dll: - 37,213,184 bytes (36,341.0 KB = 35.5 MB) + 37,218,816 bytes (36,346.5 KB = 35.5 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.Core.dll: 1,334,568 bytes (1,303.3 KB = 1.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.dll: @@ -359,11 +359,11 @@ Contents/MonoBundle/.xamarin/osx-arm64/WindowsBase.dll: Contents/MonoBundle/.xamarin/osx-x64/_Microsoft.macOS.TypeMap.dll: 4,911,616 bytes (4,796.5 KB = 4.7 MB) Contents/MonoBundle/.xamarin/osx-x64/_SizeTestApp.TypeMap.dll: - 3,072 bytes (3.0 KB = 0.0 MB) + 3,584 bytes (3.5 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.CSharp.dll: 795,944 bytes (777.3 KB = 0.8 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.macOS.dll: - 37,213,184 bytes (36,341.0 KB = 35.5 MB) + 37,218,816 bytes (36,346.5 KB = 35.5 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.Core.dll: 1,166,120 bytes (1,138.8 KB = 1.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.dll: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt index 23fdef374c71..048f1bbbdc48 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt @@ -1,13 +1,13 @@ -AppBundleSize: 247,975,409 bytes (242,163.5 KB = 236.5 MB) +AppBundleSize: 247,987,783 bytes (242,175.6 KB = 236.5 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 718 bytes (0.7 KB = 0.0 MB) + 756 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 8,028,536 bytes (7,840.4 KB = 7.7 MB) + 8,029,608 bytes (7,841.4 KB = 7.7 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.CSharp.dll: 892,712 bytes (871.8 KB = 0.9 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.macOS.dll: - 36,932,096 bytes (36,066.5 KB = 35.2 MB) + 36,937,728 bytes (36,072.0 KB = 35.2 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.Core.dll: 1,334,568 bytes (1,303.3 KB = 1.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.dll: @@ -355,7 +355,7 @@ Contents/MonoBundle/.xamarin/osx-arm64/WindowsBase.dll: Contents/MonoBundle/.xamarin/osx-x64/Microsoft.CSharp.dll: 795,944 bytes (777.3 KB = 0.8 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.macOS.dll: - 36,932,096 bytes (36,066.5 KB = 35.2 MB) + 36,937,728 bytes (36,072.0 KB = 35.2 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.Core.dll: 1,166,120 bytes (1,138.8 KB = 1.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.dll: diff --git a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt index a688b83195db..21d237f8c733 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-preservedapis.txt @@ -15,11 +15,12 @@ Microsoft.tvOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nati Microsoft.tvOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.tvOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray/<>O -Microsoft.tvOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.tvOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.tvOS.dll:CoreFoundation.CFObject Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -353,6 +354,7 @@ Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mo Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -1281,7 +1283,7 @@ Microsoft.tvOS.dll:System.Collections.Generic.List`1 Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>7__wrap2 @@ -1311,6 +1313,8 @@ Microsoft.tvOS.dll:System.Int32 Registrar.Registrar/ObjCField::Size Microsoft.tvOS.dll:System.Int32 Registrar.Trampoline::value__ Microsoft.tvOS.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.tvOS.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt index 293552f23787..967807d552b1 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-MonoVM-preservedapis.txt @@ -10,11 +10,12 @@ Microsoft.tvOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nati Microsoft.tvOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.tvOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray/<>O -Microsoft.tvOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.tvOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.tvOS.dll:CoreFoundation.CFObject Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -265,6 +266,7 @@ Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mo Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -685,7 +687,7 @@ Microsoft.tvOS.dll:System.Collections.Generic.List`1 ObjCRuntime. Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>7__wrap2 @@ -709,6 +711,8 @@ Microsoft.tvOS.dll:System.Int32 ObjCRuntime.RuntimeException::k__BackingFi Microsoft.tvOS.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.tvOS.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.tvOS.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-preservedapis.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-preservedapis.txt index dc9d89d7d853..3db4b953ba3b 100644 --- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-preservedapis.txt @@ -15,11 +15,12 @@ Microsoft.iOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nativ Microsoft.iOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.iOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray/<>O -Microsoft.iOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.iOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.iOS.dll:CoreFoundation.CFObject Microsoft.iOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -353,6 +354,7 @@ Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mod Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -1281,7 +1283,7 @@ Microsoft.iOS.dll:System.Collections.Generic.List`1 Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>7__wrap2 @@ -1311,6 +1313,8 @@ Microsoft.iOS.dll:System.Int32 Registrar.Registrar/ObjCField::Size Microsoft.iOS.dll:System.Int32 Registrar.Trampoline::value__ Microsoft.iOS.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.iOS.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-preservedapis.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-preservedapis.txt index 3d907328fb84..01c64de12371 100644 --- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-preservedapis.txt @@ -10,11 +10,12 @@ Microsoft.iOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nativ Microsoft.iOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.iOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray/<>O -Microsoft.iOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.iOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.iOS.dll:CoreFoundation.CFObject Microsoft.iOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -265,6 +266,7 @@ Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mod Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -685,7 +687,7 @@ Microsoft.iOS.dll:System.Collections.Generic.List`1 ObjCRuntime.R Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>7__wrap2 @@ -709,6 +711,8 @@ Microsoft.iOS.dll:System.Int32 ObjCRuntime.RuntimeException::k__BackingFie Microsoft.iOS.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.iOS.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.iOS.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt index 0451547f69d1..db9ea7e7f871 100644 --- a/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-MonoVM-size.txt @@ -1,11 +1,11 @@ -AppBundleSize: 9,249,530 bytes (9,032.7 KB = 8.8 MB) +AppBundleSize: 9,249,465 bytes (9,032.7 KB = 8.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: aot-instances.aotdata.arm64: 827,728 bytes (808.3 KB = 0.8 MB) Info.plist: - 1,169 bytes (1.1 KB = 0.0 MB) + 1,168 bytes (1.1 KB = 0.0 MB) Microsoft.iOS.aotdata.arm64: - 23,216 bytes (22.7 KB = 0.0 MB) + 23,168 bytes (22.6 KB = 0.0 MB) Microsoft.iOS.dll: 48,640 bytes (47.5 KB = 0.0 MB) PkgInfo: @@ -13,7 +13,7 @@ PkgInfo: runtimeconfig.bin: 1,481 bytes (1.4 KB = 0.0 MB) SizeTestApp: - 7,151,624 bytes (6,984.0 KB = 6.8 MB) + 7,151,608 bytes (6,984.0 KB = 6.8 MB) SizeTestApp.aotdata.arm64: 1,464 bytes (1.4 KB = 0.0 MB) SizeTestApp.dll: diff --git a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore index 0c083ee3f622..5cc7331e3794 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/MacCatalyst-UIKit.ignore @@ -362,9 +362,6 @@ !extra-enum-value! Managed value 3 for UITextAlignment.Justified not found in native headers !extra-enum-value! Managed value 4 for UITextAlignment.Natural not found in native headers -## manually bound -!missing-field! UIListSeparatorAutomaticInsets not bound - !incorrect-protocol-member! UISearchSuggestion::localizedAttributedSuggestion is REQUIRED and should be abstract !incorrect-protocol-member! UICalendarViewDelegate::calendarView:decorationForDateComponents: is OPTIONAL and should NOT be abstract diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreFoundation.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreFoundation.ignore index 42d31baee592..524c003c656a 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreFoundation.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreFoundation.ignore @@ -249,10 +249,7 @@ !missing-field! kCFStreamPropertySocketRemotePortNumber not bound !missing-field! kCFStringBinaryHeapCallBacks not bound !missing-field! kCFTimeZoneSystemTimeZoneDidChangeNotification not bound -!missing-field! kCFTypeArrayCallBacks not bound !missing-field! kCFTypeBagCallBacks not bound -!missing-field! kCFTypeDictionaryKeyCallBacks not bound -!missing-field! kCFTypeDictionaryValueCallBacks not bound !missing-field! kCFTypeSetCallBacks not bound !missing-field! kCFURLAddedToDirectoryDateKey not bound !missing-field! kCFURLAttributeModificationDateKey not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreMedia.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreMedia.ignore index b86f6d663cbf..af2a44a3bb10 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreMedia.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreMedia.ignore @@ -102,21 +102,12 @@ !missing-field! kCMTimeCodeFormatDescriptionExtension_SourceReferenceName not bound !missing-field! kCMTimeCodeFormatDescriptionKey_LangCode not bound !missing-field! kCMTimeCodeFormatDescriptionKey_Value not bound -!missing-field! kCMTimeEpochKey not bound -!missing-field! kCMTimeFlagsKey not bound !missing-field! kCMTimeIndefinite not bound !missing-field! kCMTimeInvalid not bound -!missing-field! kCMTimeMappingInvalid not bound -!missing-field! kCMTimeMappingSourceKey not bound -!missing-field! kCMTimeMappingTargetKey not bound !missing-field! kCMTimeNegativeInfinity not bound !missing-field! kCMTimePositiveInfinity not bound !missing-field! kCMTimeRangeDurationKey not bound -!missing-field! kCMTimeRangeInvalid not bound !missing-field! kCMTimeRangeStartKey not bound -!missing-field! kCMTimeRangeZero not bound -!missing-field! kCMTimeScaleKey not bound -!missing-field! kCMTimeValueKey not bound !missing-field! kCMTimeZero not bound !missing-field! kCMTimingInfoInvalid not bound !missing-pinvoke! CMAudioFormatDescriptionCopyAsBigEndianSoundDescriptionBlockBuffer is not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore index 6ed54ca923b9..69ee57a2dfa1 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/common-CoreVideo.ignore @@ -1,9 +1,7 @@ !missing-enum! CVPixelBufferLockFlags not bound !missing-field! kCVImageBufferICCProfileKey not bound -!missing-field! kCVIndefiniteTime not bound !missing-field! kCVPixelBufferPoolFreeBufferNotification not bound -!missing-field! kCVZeroTime not bound !missing-pinvoke! CVPixelBufferRelease is not bound !missing-pinvoke! CVPixelBufferRetain is not bound diff --git a/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore b/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore index d60aeb843f6c..e6432b67bed5 100644 --- a/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore +++ b/tests/xtro-sharpie/api-annotations-dotnet/iOS-UIKit.ignore @@ -366,9 +366,6 @@ !extra-enum-value! Managed value 3 for UITextAlignment.Justified not found in native headers !extra-enum-value! Managed value 4 for UITextAlignment.Natural not found in native headers -## manually bound -!missing-field! UIListSeparatorAutomaticInsets not bound - !incorrect-protocol-member! UISearchSuggestion::localizedAttributedSuggestion is REQUIRED and should be abstract !incorrect-protocol-member! UICalendarViewDelegate::calendarView:decorationForDateComponents: is OPTIONAL and should NOT be abstract From d17ed03c1afdbe2a832cc6b55379555443817087 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 4 Aug 2026 19:04:24 +0200 Subject: [PATCH 04/23] [dotnet-linker] Don't preserve base type members for [Preserve (AllMembers = true)]. (#26362) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the assembly preparer applies `[Preserve (AllMembers = true)]` (and when it preserves NSObject subclasses in user assemblies), it used to emit a single `[DynamicDependency (DynamicallyAccessedMemberTypes.…, typeof (TheType))]` attribute on the module constructor. That's not equivalent to `[Preserve (AllMembers = true)]`: the trimmer resolves `DynamicallyAccessedMemberTypes` over the entire type hierarchy, so every member of every base type is preserved as well. For an NSObject subclass that means all of `NSObject` is preserved - and `NSObject` in turn drags in `NSNumber`, `NSValue`, `NSArray`, `ObjCRuntime.Messaging`, `System.Drawing.PointF/SizeF/ RectangleF` and, transitively, the `System.Drawing`, `System.Drawing.Primitives`, `System.ObjectModel` and `System.ComponentModel.TypeConverter` assemblies. Emit one `DynamicDependency` attribute per member declared on the type instead, which matches `[Preserve (AllMembers = true)]` semantics exactly. This only affects the assembly preparer (PrepareAssemblies=true); when our steps run inside ILLink we use an xml descriptor file, which already had the correct semantics. Size impact for tests/dotnet/SizeTestApp/iOS (net11.0, ios-arm64, Release, CoreCLR + ReadyToRun, trimmable-static + PrepareAssemblies + PostProcessAssemblies): | Configuration | App size | |-------------------------------------|--------------| | Before | 11,523,224 B | | After | 11,380,424 B | | **Difference** | **-142,800 B (-1.24%)** | which brings trimmable-static to within 0.38% of managed-static (11,337,504 B), down from 1.6%. Copilot-Session: 6aeeddfd-3bd8-4129-ad90-7292860c4b66 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Rolf Bjarne Kvinge --- ...atalyst-NativeAOT-TrimmableStatic-size.txt | 6 +- .../expected/MacCatalyst-NativeAOT-size.txt | 6 +- .../MacOSX-NativeAOT-TrimmableStatic-size.txt | 6 +- .../expected/MacOSX-NativeAOT-size.txt | 6 +- .../TVOS-NativeAOT-TrimmableStatic-size.txt | 6 +- .../expected/TVOS-NativeAOT-size.txt | 6 +- .../iOS-NativeAOT-TrimmableStatic-size.txt | 6 +- .../UnitTests/expected/iOS-NativeAOT-size.txt | 6 +- tools/dotnet-linker/AppBundleRewriter.cs | 76 +++++++++++++++++++ .../ApplyPreserveAttributeStep.cs | 24 +++--- tools/dotnet-linker/MarkNSObjectsStep.cs | 25 ++---- 11 files changed, 114 insertions(+), 59 deletions(-) diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt index 5b7daafe7158..2353a2ecefbb 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 8,522,558 bytes (8,322.8 KB = 8.1 MB) +AppBundleSize: 8,389,725 bytes (8,193.1 KB = 8.0 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 1,046 bytes (1.0 KB = 0.0 MB) + 1,061 bytes (1.0 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 8,519,608 bytes (8,319.9 KB = 8.1 MB) + 8,386,760 bytes (8,190.2 KB = 8.0 MB) Contents/MonoBundle/runtimeconfig.bin: 1,896 bytes (1.9 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt index ef510e1c83bd..7d580f1f8910 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 2,459,606 bytes (2,402.0 KB = 2.3 MB) +AppBundleSize: 2,026,517 bytes (1,979.0 KB = 1.9 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 1,046 bytes (1.0 KB = 0.0 MB) + 1,061 bytes (1.0 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 2,456,744 bytes (2,399.2 KB = 2.3 MB) + 2,023,640 bytes (1,976.2 KB = 1.9 MB) Contents/MonoBundle/runtimeconfig.bin: 1,808 bytes (1.8 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt index c34f038e228b..6d88b848995b 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 20,952,172 bytes (20,461.1 KB = 20.0 MB) +AppBundleSize: 20,935,691 bytes (20,445.0 KB = 20.0 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 724 bytes (0.7 KB = 0.0 MB) + 739 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 17,862,888 bytes (17,444.2 KB = 17.0 MB) + 17,846,392 bytes (17,428.1 KB = 17.0 MB) Contents/MonoBundle/libSystem.Globalization.Native.dylib: 267,872 bytes (261.6 KB = 0.3 MB) Contents/MonoBundle/libSystem.IO.Compression.Native.dylib: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt index 20ae526a3f42..2dd7c87d47f7 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 8,185,514 bytes (7,993.7 KB = 7.8 MB) +AppBundleSize: 7,373,817 bytes (7,201.0 KB = 7.0 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 724 bytes (0.7 KB = 0.0 MB) + 739 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 5,096,312 bytes (4,976.9 KB = 4.9 MB) + 4,284,600 bytes (4,184.2 KB = 4.1 MB) Contents/MonoBundle/libSystem.Globalization.Native.dylib: 267,872 bytes (261.6 KB = 0.3 MB) Contents/MonoBundle/libSystem.IO.Compression.Native.dylib: diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt index cc54565269a5..5b404d33d6a9 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 7,557,209 bytes (7,380.1 KB = 7.2 MB) +AppBundleSize: 7,458,216 bytes (7,283.4 KB = 7.1 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,112 bytes (1.1 KB = 0.0 MB) + 1,127 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,889 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 7,554,200 bytes (7,377.1 KB = 7.2 MB) + 7,455,192 bytes (7,280.5 KB = 7.1 MB) diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt index 875cbc42c037..6c01a3e6e59e 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 2,408,872 bytes (2,352.4 KB = 2.3 MB) +AppBundleSize: 2,011,759 bytes (1,964.6 KB = 1.9 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,112 bytes (1.1 KB = 0.0 MB) + 1,127 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,808 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 2,405,944 bytes (2,349.6 KB = 2.3 MB) + 2,008,816 bytes (1,961.7 KB = 1.9 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt index 7f6028573fab..52754cf5c239 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 8,750,712 bytes (8,545.6 KB = 8.3 MB) +AppBundleSize: 8,635,255 bytes (8,432.9 KB = 8.2 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,136 bytes (1.1 KB = 0.0 MB) + 1,151 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,888 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 8,747,680 bytes (8,542.7 KB = 8.3 MB) + 8,632,208 bytes (8,429.9 KB = 8.2 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt index c26208711dba..c0bcadf4c384 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 2,425,600 bytes (2,368.8 KB = 2.3 MB) +AppBundleSize: 2,012,023 bytes (1,964.9 KB = 1.9 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,136 bytes (1.1 KB = 0.0 MB) + 1,151 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,808 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 2,422,648 bytes (2,365.9 KB = 2.3 MB) + 2,009,056 bytes (1,962.0 KB = 1.9 MB) diff --git a/tools/dotnet-linker/AppBundleRewriter.cs b/tools/dotnet-linker/AppBundleRewriter.cs index 3041de11b513..4ff20533cadd 100644 --- a/tools/dotnet-linker/AppBundleRewriter.cs +++ b/tools/dotnet-linker/AppBundleRewriter.cs @@ -1599,6 +1599,82 @@ public CustomAttribute CreateDynamicDependencyAttribute (DynamicallyAccessedMemb return attribute; } + /// + /// Preserve all the members declared on a type (and the type itself), which is what + /// [Preserve (AllMembers = true)] means. + /// + /// + /// + /// A DynamicDependency attribute with DynamicallyAccessedMemberTypes can't be used here: the trimmer + /// resolves those member types over the entire type hierarchy, so it would also preserve every member + /// of every base type (for an NSObject subclass that means all of NSObject, which is quite big). + /// Instead add one DynamicDependency attribute per member declared on the type itself, and a single + /// DynamicDependency attribute for the interfaces the type implements. + /// + /// + /// The method on which to add the dynamic dependency attributes. + /// The type whose members should be preserved. + public bool AddPreserveAllMembersDynamicDependencyAttributes (MethodDefinition addToMethod, TypeDefinition type) + { + var signatures = new HashSet (StringComparer.Ordinal); + + foreach (var field in type.Fields) { + if (!field.HasCustomAttribute ("System.Runtime.CompilerServices", "CompilerGeneratedAttribute")) + signatures.Add (DocumentationComments.GetSignature (field)); + } + foreach (var method in type.Methods) { + if (!method.HasCustomAttribute ("System.Runtime.CompilerServices", "CompilerGeneratedAttribute")) + signatures.Add (DocumentationComments.GetSignature (method)); + } + // Properties and events don't have a documentation comment signature helper, but the trimmer will + // match any member with the given name, which is good enough (and it's what we want here anyway). + foreach (var property in type.Properties) + signatures.Add (property.Name); + foreach (var @event in type.Events) + signatures.Add (@event.Name); + + if (signatures.Count == 0) { + // The type has no declared members, so add a placeholder member and preserve that, + // which will keep the type itself (same pattern as AddDynamicDependencyAttributeToStaticConstructor). + var placeholderName = "__linker_preserve__"; + FieldDefinition? placeholderMember = null; + if (type.HasFields) + placeholderMember = type.Fields.FirstOrDefault (f => f.Name == placeholderName && f.IsStatic); + if (placeholderMember is null) { + placeholderMember = new FieldDefinition (placeholderName, FieldAttributes.Private | FieldAttributes.Static, System_Int32); + type.Fields.Add (placeholderMember); + } + signatures.Add (DocumentationComments.GetSignature (placeholderMember)); + } + + var modified = false; + foreach (var signature in signatures.OrderBy (v => v, StringComparer.Ordinal)) + modified |= AddAttributeOnlyOnce (addToMethod, CreateDynamicDependencyAttribute (signature, type)); + + // The interfaces a type implements must be preserved as well: the static registrar needs the + // protocol interfaces (and the custom attributes on them) to find the block proxy types it + // references from the generated native code. + // Only do this if there are any interfaces to preserve, otherwise the trimmer complains that + // no members were resolved for the attribute (IL2037). + if (HasAnyInterfaces (type)) + modified |= AddAttributeOnlyOnce (addToMethod, CreateDynamicDependencyAttribute (DynamicallyAccessedMemberTypes.Interfaces, type)); + + return modified; + } + + /// + /// Returns true if the type, or any of its base types, implements any interfaces. + /// + static bool HasAnyInterfaces (TypeDefinition? type) + { + while (type is not null) { + if (type.HasInterfaces) + return true; + type = type.BaseType?.Resolve (); + } + return false; + } + /// /// Preserve a method conditionally on another type /// diff --git a/tools/dotnet-linker/ApplyPreserveAttributeStep.cs b/tools/dotnet-linker/ApplyPreserveAttributeStep.cs index 92a5fe87aca1..2212b79e542f 100644 --- a/tools/dotnet-linker/ApplyPreserveAttributeStep.cs +++ b/tools/dotnet-linker/ApplyPreserveAttributeStep.cs @@ -115,29 +115,23 @@ bool IApplyPreserveAttribute.PreserveConditional (TypeDefinition onType, MethodD return AddConditionalDynamicDependencyAttribute (onType, forMethod); } - // We want to avoid `DynamicallyAccessedMemberTypes.All` because the semantics are different - // from `[Preserve (AllMembers = true)]`. Specifically, we don't want to preserve nested types. - // `All` would also keep unused private members of base types which `Preserve` also doesn't cover. - const DynamicallyAccessedMemberTypes allMemberTypes = - DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields - | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties - | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods - | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors - | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents - | DynamicallyAccessedMemberTypes.Interfaces; - bool AddDynamicDependencyAttribute (TypeDefinition type, bool allMembers) { var moduleConstructor = GetOrCreateModuleConstructor (abr.CurrentAssembly.MainModule, out var modified); - var members = allMembers - ? allMemberTypes - : DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors; // only preserve fields for enums if (type.IsEnum) { - members = DynamicallyAccessedMemberTypes.PublicFields; + var enumAttrib = abr.CreateDynamicDependencyAttribute (DynamicallyAccessedMemberTypes.PublicFields, type); + modified |= abr.AddAttributeOnlyOnce (moduleConstructor, enumAttrib); + return modified; + } + + if (allMembers) { + modified |= abr.AddPreserveAllMembersDynamicDependencyAttributes (moduleConstructor, type); + return modified; } + var members = DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors; var attrib = abr.CreateDynamicDependencyAttribute (members, type); modified |= abr.AddAttributeOnlyOnce (moduleConstructor, attrib); return modified; diff --git a/tools/dotnet-linker/MarkNSObjectsStep.cs b/tools/dotnet-linker/MarkNSObjectsStep.cs index 3338ec181260..9862c8a8f547 100644 --- a/tools/dotnet-linker/MarkNSObjectsStep.cs +++ b/tools/dotnet-linker/MarkNSObjectsStep.cs @@ -44,7 +44,11 @@ protected override bool ProcessType (TypeDefinition type) public bool PreserveType (TypeDefinition type, bool allMembers) { var moduleConstructor = abr.GetOrCreateStaticConstructor (type.Module.GetModuleType (), out var modified); - var attrib = CreateDynamicDependencyAttribute (type, allMembers); + if (allMembers) { + modified |= abr.AddPreserveAllMembersDynamicDependencyAttributes (moduleConstructor, type); + return modified; + } + var attrib = abr.CreateDynamicDependencyAttribute (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors, type); modified |= abr.AddAttributeOnlyOnce (moduleConstructor, attrib); return modified; } @@ -54,25 +58,6 @@ public bool PreserveType (TypeDefinition onType, TypeDefinition type) return abr.AddDynamicDependencyAttributeToStaticConstructor (onType, type); } - // We want to avoid `DynamicallyAccessedMemberTypes.All` because it preserves nested types. - // `All` would also keep unused private members of base types. - const DynamicallyAccessedMemberTypes allMemberTypes = - DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields - | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties - | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods - | DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors - | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents - | DynamicallyAccessedMemberTypes.Interfaces; - - CustomAttribute CreateDynamicDependencyAttribute (TypeDefinition type, bool allMembers) - { - var members = allMembers - ? allMemberTypes - : DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors; - - return abr.CreateDynamicDependencyAttribute (members, type); - } - public bool PreserveMethod (TypeDefinition onType, MethodDefinition method) { return abr.AddDynamicDependencyAttributeToStaticConstructor (onType, method); From aed655869e9dc5164b98d224fbeedecb32384dce Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 4 Aug 2026 19:05:02 +0200 Subject: [PATCH 05/23] [dotnet] Default to the trimmable-static registrar for NativeAOT on .NET 11 (#26346) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On .NET 11+, default `Registrar` to `trimmable-static` (instead of `managed-static`) for NativeAOT, and enable the `PrepareAssemblies` / `PostProcessAssemblies` flow by default for NativeAOT. All three are set at evaluation time (in `Xamarin.Shared.Sdk.props`) rather than in the `SelectRegistrar` target, because the static `_SkipILLink` / `_PostprocessAssembliesAfterIlc` gates read them at evaluation time. `PostProcessAssemblies` normally defaults to `$(PrepareAssemblies)` in `Xamarin.Shared.targets`, but that default runs later than the gate reads it, so the same default is applied here too. This is a **no-op on .NET 10** — every condition requires `TargetFrameworkVersion >= 11.0`. Verified: all `AppSizeTest` NativeAOT and NativeAOT_TrimmableStatic expected sizes are unchanged on `main` (within ±5 bytes), so no expected files needed updating. ## Why NativeAOT only? Because there would be a significant size regression with CoreCLR (fixes are in progress for this and the default will be changed for CoreCLR as well). Mono won't change to keep it as compatible as possible. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/targets/Xamarin.Shared.Sdk.props | 29 +++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.props b/dotnet/targets/Xamarin.Shared.Sdk.props index b317dcc9ed10..6cdaf1762789 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.props +++ b/dotnet/targets/Xamarin.Shared.Sdk.props @@ -40,6 +40,35 @@ --> <_UseNativeAot Condition="'$(PublishAot)' == 'true' And '$(_IsPublishing)' == 'true'">true + + trimmable-static + + + true + + + $(PrepareAssemblies) + false false true From a47ea1a0d3b31ddd1eb570c3a79de36a053d2322 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 4 Aug 2026 20:18:57 +0200 Subject: [PATCH 06/23] [docs] Improve XML docs for ten types (#26399) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve XML documentation for: - `AVAudioBuffer` - `TimeSpec` - `AdviceAttribute` - `FIMenuKind` - `SecStatusCodeExtensions` - `RequiredFrameworkAttribute` - `MLMediaSourceType` - `SLRequestMethod` - `MLMediaType` - `SLComposeViewControllerResult` Each type is documented in a separate commit. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/AVFoundation/AVAudioBuffer.cs | 9 +++------ src/Darwin/TimeSpec.cs | 9 +++------ src/FinderSync/Enums.cs | 11 +++++------ src/Foundation/AdviceAttribute.cs | 12 +++++------- src/MediaLibrary/Enums.cs | 14 ++++++++------ src/ObjCRuntime/RequiredFrameworkAttribute.cs | 13 +++++-------- src/Security/SecStatusCodeExtensions.cs | 10 ++++------ src/Social/Enums.cs | 12 ++++++------ tests/cecil-tests/Documentation.KnownFailures.txt | 2 -- 9 files changed, 39 insertions(+), 53 deletions(-) diff --git a/src/AVFoundation/AVAudioBuffer.cs b/src/AVFoundation/AVAudioBuffer.cs index c89ef42d6f03..08b227ad1567 100644 --- a/src/AVFoundation/AVAudioBuffer.cs +++ b/src/AVFoundation/AVAudioBuffer.cs @@ -11,12 +11,10 @@ namespace AVFoundation { /// A buffer for audio data. - /// To be added. /// Apple documentation for AVAudioBuffer public partial class AVAudioBuffer { - /// To be added. - /// To be added. - /// To be added. + /// Gets the audio buffer list containing the buffer's audio data. + /// The audio buffer list. public AudioBuffers AudioBufferList { get { return new AudioBuffers (audioBufferList); @@ -24,8 +22,7 @@ public AudioBuffers AudioBufferList { } /// Gets a mutable version of the underlying . - /// To be added. - /// To be added. + /// The mutable audio buffer list. public AudioBuffers MutableAudioBufferList { get { return new AudioBuffers (mutableAudioBufferList); diff --git a/src/Darwin/TimeSpec.cs b/src/Darwin/TimeSpec.cs index 6ccc4a2d520f..adc47b86aa91 100644 --- a/src/Darwin/TimeSpec.cs +++ b/src/Darwin/TimeSpec.cs @@ -2,16 +2,13 @@ #nullable enable namespace Darwin { - /// To be added. - /// To be added. + /// Represents a POSIX time value with nanosecond precision. [StructLayout (LayoutKind.Sequential)] [NativeName ("timespec")] public struct TimeSpec { - /// To be added. - /// To be added. + /// The number of whole seconds. public nint Seconds; - /// To be added. - /// To be added. + /// The additional number of nanoseconds. public nint NanoSeconds; } } diff --git a/src/FinderSync/Enums.cs b/src/FinderSync/Enums.cs index d01d29883ad7..548e235930d7 100644 --- a/src/FinderSync/Enums.cs +++ b/src/FinderSync/Enums.cs @@ -1,17 +1,16 @@ #nullable enable namespace FinderSync { - /// To be added. - /// To be added. + /// Specifies the Finder location where a Finder Sync extension menu appears. [Native] public enum FIMenuKind : ulong { - /// To be added. + /// A contextual menu for selected items. ContextualMenuForItems = 0, - /// To be added. + /// A contextual menu for the background of a monitored folder. ContextualMenuForContainer = 1, - /// To be added. + /// A contextual menu for an item in the Finder sidebar. ContextualMenuForSidebar = 2, - /// To be added. + /// The menu associated with the extension's Finder toolbar item. ToolbarItemMenu = 3, } } diff --git a/src/Foundation/AdviceAttribute.cs b/src/Foundation/AdviceAttribute.cs index 204b26afa860..d3f954a4be9a 100644 --- a/src/Foundation/AdviceAttribute.cs +++ b/src/Foundation/AdviceAttribute.cs @@ -29,7 +29,7 @@ namespace Foundation { /// An attribute that can be used to give programming advice to a user of a function or class. - /// This attribute is intended to give developers some guidance as to what to do.   The contents of the attribute are displayed by the IDE when the user is using a feature like code analysis to give hints as to how to improve the code. + /// Development tools can display the advice during code analysis to suggest improvements. [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | @@ -37,17 +37,15 @@ namespace Foundation { AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = true)] public class AdviceAttribute : Attribute { - /// To be added. - /// To be added. - /// To be added. + /// Creates an advice attribute with the specified message. + /// The programming advice to present to developers. public AdviceAttribute (string message) { Message = message; } - /// To be added. - /// To be added. - /// To be added. + /// Gets the programming advice. + /// The message to present to developers. public string Message { get; private set; } } } diff --git a/src/MediaLibrary/Enums.cs b/src/MediaLibrary/Enums.cs index aadacc6ced1d..4b2e11d9ca89 100644 --- a/src/MediaLibrary/Enums.cs +++ b/src/MediaLibrary/Enums.cs @@ -22,23 +22,25 @@ // namespace MediaLibrary { + /// A bitmask specifying the kinds of media provided by a media source. [Native] public enum MLMediaSourceType : ulong { - /// To be added. + /// The source provides audio media. Audio = 1 << 0, - /// To be added. + /// The source provides image media. Image = 1 << 1, - /// To be added. + /// The source provides movie media. Movie = 1 << 2, } + /// A bitmask specifying one or more kinds of media objects. [Native] public enum MLMediaType : ulong { - /// To be added. + /// Audio media. Audio = 1 << 0, - /// To be added. + /// Image media. Image = 1 << 1, - /// To be added. + /// Movie media. Movie = 1 << 2, } } diff --git a/src/ObjCRuntime/RequiredFrameworkAttribute.cs b/src/ObjCRuntime/RequiredFrameworkAttribute.cs index 58346f2f42d3..e16a285899b6 100644 --- a/src/ObjCRuntime/RequiredFrameworkAttribute.cs +++ b/src/ObjCRuntime/RequiredFrameworkAttribute.cs @@ -27,18 +27,15 @@ namespace ObjCRuntime { - /// To be added. - /// To be added. + /// Specifies a native framework required by an assembly. [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)] public class RequiredFrameworkAttribute : Attribute { - /// To be added. - /// To be added. - /// To be added. + /// Gets the name of the required framework. + /// The framework name. public string Name { get; private set; } - /// To be added. - /// To be added. - /// To be added. + /// Creates an attribute for the specified required framework. + /// The framework name. public RequiredFrameworkAttribute (string name) { Name = name; diff --git a/src/Security/SecStatusCodeExtensions.cs b/src/Security/SecStatusCodeExtensions.cs index 3b4d92c95cb0..ae09d01f1423 100644 --- a/src/Security/SecStatusCodeExtensions.cs +++ b/src/Security/SecStatusCodeExtensions.cs @@ -10,8 +10,7 @@ #nullable enable namespace Security { - /// To be added. - /// To be added. + /// Provides convenience methods for security status codes. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -26,10 +25,9 @@ public static class SecStatusCodeExtensions { /* OSStatus */ SecStatusCode status, /* void * */ IntPtr reserved); /* always null */ - /// To be added. - /// To be added. - /// To be added. - /// To be added. + /// Gets a human-readable description of a security status code. + /// The security status code to describe. + /// A description of , or if no description is available. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("tvos")] [SupportedOSPlatform ("maccatalyst")] diff --git a/src/Social/Enums.cs b/src/Social/Enums.cs index b1be973e8c5e..46202c8efc5a 100644 --- a/src/Social/Enums.cs +++ b/src/Social/Enums.cs @@ -13,13 +13,13 @@ namespace Social { /// The HTTP verb associated with a social service request. [Native] public enum SLRequestMethod : long { - /// To be added. + /// An HTTP GET request. Get, - /// To be added. + /// An HTTP POST request. Post, - /// To be added. + /// An HTTP DELETE request. Delete, - /// To be added. + /// An HTTP PUT request. Put, } @@ -29,9 +29,9 @@ public enum SLRequestMethod : long { [MacCatalyst (13, 1)] [Native] public enum SLComposeViewControllerResult : long { - /// To be added. + /// The user cancelled composition. Cancelled, - /// To be added. + /// The user completed composition. Done, } } diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 9d658fa630c1..3382c8a41590 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -24602,8 +24602,6 @@ T:MediaLibrary.MLMediaGroup T:MediaLibrary.MLMediaLibrary T:MediaLibrary.MLMediaObject T:MediaLibrary.MLMediaSource -T:MediaLibrary.MLMediaSourceType -T:MediaLibrary.MLMediaType T:MediaPlayer.AVMediaSelectionGroup_MPNowPlayingInfoLanguageOptionAdditions T:MediaPlayer.AVMediaSelectionOption_MPNowPlayingInfoLanguageOptionAdditions T:MediaPlayer.MPAdTimeRange From 93f9d035df087f20bbaad80ff15188f09fd432e2 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 5 Aug 2026 15:25:42 +0200 Subject: [PATCH 07/23] [dotnet-linker] Don't emit parameter names for generated proxy methods. (#26363) Don't emit parameter names in the generated registrar code. Cecil only emits a Param row for parameters that have a name (or attributes, marshalling info or a default value), and the parameter names of these generated methods have no value to anyone. Copilot-Session: 6aeeddfd-3bd8-4129-ad90-7292860c4b66 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Rolf Bjarne Kvinge Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- ...atalyst-NativeAOT-TrimmableStatic-size.txt | 6 ++--- ...reCLR-Interpreter-TrimmableStatic-size.txt | 18 +++++++------- .../MacOSX-CoreCLR-Interpreter-size.txt | 14 +++++------ .../MacOSX-NativeAOT-TrimmableStatic-size.txt | 6 ++--- .../TVOS-NativeAOT-TrimmableStatic-size.txt | 6 ++--- .../expected/TVOS-NativeAOT-size.txt | 4 ++-- .../iOS-NativeAOT-TrimmableStatic-size.txt | 6 ++--- tools/dotnet-linker/AppBundleRewriter.cs | 6 ++--- tools/dotnet-linker/CecilExtensions.cs | 10 ++++++++ .../RegistrarCompanionAssembly.cs | 2 +- .../Steps/ManagedRegistrarLookupTablesStep.cs | 24 +++++++++---------- .../Steps/ManagedRegistrarStep.cs | 12 +++++----- .../Steps/TrimmableRegistrarStep.cs | 14 +++++------ 13 files changed, 69 insertions(+), 59 deletions(-) diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt index 2353a2ecefbb..524e7b0cfb4e 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 8,389,725 bytes (8,193.1 KB = 8.0 MB) +AppBundleSize: 8,356,712 bytes (8,160.9 KB = 8.0 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 1,061 bytes (1.0 KB = 0.0 MB) + 1,072 bytes (1.0 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 8,386,760 bytes (8,190.2 KB = 8.0 MB) + 8,353,736 bytes (8,157.9 KB = 8.0 MB) Contents/MonoBundle/runtimeconfig.bin: 1,896 bytes (1.9 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt index 3b5bd4555ebf..2ac78744609c 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt @@ -1,17 +1,17 @@ -AppBundleSize: 257,737,625 bytes (251,696.9 KB = 245.8 MB) +AppBundleSize: 257,029,891 bytes (251,005.8 KB = 245.1 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 756 bytes (0.7 KB = 0.0 MB) + 750 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 7,387,816 bytes (7,214.7 KB = 7.0 MB) + 7,387,672 bytes (7,214.5 KB = 7.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/_Microsoft.macOS.TypeMap.dll: - 4,911,616 bytes (4,796.5 KB = 4.7 MB) + 4,775,936 bytes (4,664.0 KB = 4.6 MB) Contents/MonoBundle/.xamarin/osx-arm64/_SizeTestApp.TypeMap.dll: - 3,584 bytes (3.5 KB = 0.0 MB) + 3,072 bytes (3.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.CSharp.dll: 892,712 bytes (871.8 KB = 0.9 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.macOS.dll: - 37,218,816 bytes (36,346.5 KB = 35.5 MB) + 37,001,216 bytes (36,134.0 KB = 35.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.Core.dll: 1,334,568 bytes (1,303.3 KB = 1.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.dll: @@ -357,13 +357,13 @@ Contents/MonoBundle/.xamarin/osx-arm64/System.Xml.XPath.XDocument.dll: Contents/MonoBundle/.xamarin/osx-arm64/WindowsBase.dll: 16,208 bytes (15.8 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/_Microsoft.macOS.TypeMap.dll: - 4,911,616 bytes (4,796.5 KB = 4.7 MB) + 4,775,936 bytes (4,664.0 KB = 4.6 MB) Contents/MonoBundle/.xamarin/osx-x64/_SizeTestApp.TypeMap.dll: - 3,584 bytes (3.5 KB = 0.0 MB) + 3,072 bytes (3.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.CSharp.dll: 795,944 bytes (777.3 KB = 0.8 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.macOS.dll: - 37,218,816 bytes (36,346.5 KB = 35.5 MB) + 37,001,216 bytes (36,134.0 KB = 35.3 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.Core.dll: 1,166,120 bytes (1,138.8 KB = 1.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.dll: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt index 048f1bbbdc48..effcad289b45 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt @@ -1,13 +1,13 @@ -AppBundleSize: 247,987,783 bytes (242,175.6 KB = 236.5 MB) +AppBundleSize: 247,540,145 bytes (241,738.4 KB = 236.1 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 756 bytes (0.7 KB = 0.0 MB) + 750 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 8,029,608 bytes (7,841.4 KB = 7.7 MB) + 8,029,464 bytes (7,841.3 KB = 7.7 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.CSharp.dll: 892,712 bytes (871.8 KB = 0.9 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.macOS.dll: - 36,937,728 bytes (36,072.0 KB = 35.2 MB) + 36,714,496 bytes (35,854.0 KB = 35.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.Core.dll: 1,334,568 bytes (1,303.3 KB = 1.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.dll: @@ -21,7 +21,7 @@ Contents/MonoBundle/.xamarin/osx-arm64/mscorlib.dll: Contents/MonoBundle/.xamarin/osx-arm64/netstandard.dll: 100,688 bytes (98.3 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-arm64/SizeTestApp.dll: - 6,656 bytes (6.5 KB = 0.0 MB) + 6,144 bytes (6.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/System.AppContext.dll: 15,144 bytes (14.8 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/System.Buffers.dll: @@ -355,7 +355,7 @@ Contents/MonoBundle/.xamarin/osx-arm64/WindowsBase.dll: Contents/MonoBundle/.xamarin/osx-x64/Microsoft.CSharp.dll: 795,944 bytes (777.3 KB = 0.8 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.macOS.dll: - 36,937,728 bytes (36,072.0 KB = 35.2 MB) + 36,714,496 bytes (35,854.0 KB = 35.0 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.Core.dll: 1,166,120 bytes (1,138.8 KB = 1.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.dll: @@ -369,7 +369,7 @@ Contents/MonoBundle/.xamarin/osx-x64/mscorlib.dll: Contents/MonoBundle/.xamarin/osx-x64/netstandard.dll: 100,648 bytes (98.3 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-x64/SizeTestApp.dll: - 6,656 bytes (6.5 KB = 0.0 MB) + 6,144 bytes (6.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/System.AppContext.dll: 15,144 bytes (14.8 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/System.Buffers.dll: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt index 6d88b848995b..38345cc41f75 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 20,935,691 bytes (20,445.0 KB = 20.0 MB) +AppBundleSize: 20,869,926 bytes (20,380.8 KB = 19.9 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 739 bytes (0.7 KB = 0.0 MB) + 750 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 17,846,392 bytes (17,428.1 KB = 17.0 MB) + 17,780,616 bytes (17,363.9 KB = 17.0 MB) Contents/MonoBundle/libSystem.Globalization.Native.dylib: 267,872 bytes (261.6 KB = 0.3 MB) Contents/MonoBundle/libSystem.IO.Compression.Native.dylib: diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt index 5b404d33d6a9..29f1e0ed5548 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 7,458,216 bytes (7,283.4 KB = 7.1 MB) +AppBundleSize: 7,425,459 bytes (7,251.4 KB = 7.1 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,127 bytes (1.1 KB = 0.0 MB) + 1,138 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,889 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 7,455,192 bytes (7,280.5 KB = 7.1 MB) + 7,422,424 bytes (7,248.5 KB = 7.1 MB) diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt index 6c01a3e6e59e..a70b6db0a5d0 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt @@ -1,7 +1,7 @@ -AppBundleSize: 2,011,759 bytes (1,964.6 KB = 1.9 MB) +AppBundleSize: 2,011,770 bytes (1,964.6 KB = 1.9 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,127 bytes (1.1 KB = 0.0 MB) + 1,138 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt index 52754cf5c239..59cab06d7379 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 8,635,255 bytes (8,432.9 KB = 8.2 MB) +AppBundleSize: 8,586,114 bytes (8,384.9 KB = 8.2 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,151 bytes (1.1 KB = 0.0 MB) + 1,162 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,888 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 8,632,208 bytes (8,429.9 KB = 8.2 MB) + 8,583,056 bytes (8,381.9 KB = 8.2 MB) diff --git a/tools/dotnet-linker/AppBundleRewriter.cs b/tools/dotnet-linker/AppBundleRewriter.cs index 4ff20533cadd..8e79a5b8f32a 100644 --- a/tools/dotnet-linker/AppBundleRewriter.cs +++ b/tools/dotnet-linker/AppBundleRewriter.cs @@ -1934,7 +1934,7 @@ internal bool ImplementConstructNSObjectFactoryMethod (Tuner.DerivedLinkContext AddTypeInterfaceImplementation (abr, context, type, abr.Foundation_INSObjectFactory); var createInstanceMethod = type.AddMethod ("_Xamarin_ConstructNSObject", MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.NewSlot | MethodAttributes.HideBySig, abr.Foundation_NSObject); - var nativeHandleParameter = createInstanceMethod.AddParameter ("nativeHandle", abr.ObjCRuntime_NativeHandle); + var nativeHandleParameter = createInstanceMethod.AddParameter (abr.ObjCRuntime_NativeHandle); // nativeHandle abr.Foundation_INSObjectFactory.Resolve ().IsPublic = true; createInstanceMethod.Overrides.Add (abr.INSObjectFactory__Xamarin_ConstructNSObject); var body = createInstanceMethod.CreateBody (out var il); @@ -1981,8 +1981,8 @@ internal bool ImplementConstructINativeObjectFactoryMethod (Tuner.DerivedLinkCon AddTypeInterfaceImplementation (abr, context, type, abr.ObjCRuntime_INativeObject); var createInstanceMethod = type.AddMethod ("_Xamarin_ConstructINativeObject", MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.NewSlot | MethodAttributes.HideBySig, abr.ObjCRuntime_INativeObject); - var nativeHandleParameter = createInstanceMethod.AddParameter ("nativeHandle", abr.ObjCRuntime_NativeHandle); - var ownsParameter = createInstanceMethod.AddParameter ("owns", abr.System_Boolean); + var nativeHandleParameter = createInstanceMethod.AddParameter (abr.ObjCRuntime_NativeHandle); // nativeHandle + var ownsParameter = createInstanceMethod.AddParameter (abr.System_Boolean); // owns abr.INativeObject__Xamarin_ConstructINativeObject.Resolve ().IsPublic = true; createInstanceMethod.Overrides.Add (abr.INativeObject__Xamarin_ConstructINativeObject); var body = createInstanceMethod.CreateBody (out var il); diff --git a/tools/dotnet-linker/CecilExtensions.cs b/tools/dotnet-linker/CecilExtensions.cs index 2831ac7ace71..eabb02a43cad 100644 --- a/tools/dotnet-linker/CecilExtensions.cs +++ b/tools/dotnet-linker/CecilExtensions.cs @@ -26,6 +26,16 @@ public static ParameterDefinition AddParameter (this MethodDefinition self, stri return rv; } + // Adds a parameter without a name. Cecil only emits a Param row for parameters that have a + // name (or attributes / marshal info / a constant value), so this keeps the metadata smaller. + // Only use this for generated methods where the parameter names have no value. + public static ParameterDefinition AddParameter (this MethodDefinition self, TypeReference parameterType) + { + var rv = new ParameterDefinition (parameterType); + self.Parameters.Add (rv); + return rv; + } + public static MethodDefinition AddMethod (this TypeDefinition self, string name, MethodAttributes attributes, TypeReference returnType) { var rv = new MethodDefinition (name, attributes, returnType); diff --git a/tools/dotnet-linker/RegistrarCompanionAssembly.cs b/tools/dotnet-linker/RegistrarCompanionAssembly.cs index 86ed16e3ce4f..81b1e8d0d67c 100644 --- a/tools/dotnet-linker/RegistrarCompanionAssembly.cs +++ b/tools/dotnet-linker/RegistrarCompanionAssembly.cs @@ -72,7 +72,7 @@ public static RegistrarCompanionAssembly GetOrCreate (LinkerConfiguration config */ var ignoredAccessChecks = new TypeDefinition ("System.Runtime.CompilerServices", "IgnoresAccessChecksToAttribute", TypeAttributes.NotPublic | TypeAttributes.Sealed | TypeAttributes.BeforeFieldInit, abr.System_Attribute); var ignoredAccessChecksCtor = new MethodDefinition (".ctor", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName, abr.System_Void); - ignoredAccessChecksCtor.AddParameter ("assemblyName", abr.System_String); + ignoredAccessChecksCtor.AddParameter (abr.System_String); // assemblyName var il = ignoredAccessChecksCtor.Body.GetILProcessor (); il.Append (il.Create (OpCodes.Ldarg_0)); il.Append (il.Create (OpCodes.Call, abr.System_Attribute__ctor)); diff --git a/tools/dotnet-linker/Steps/ManagedRegistrarLookupTablesStep.cs b/tools/dotnet-linker/Steps/ManagedRegistrarLookupTablesStep.cs index 499ad0a43357..4a5dd9acc19e 100644 --- a/tools/dotnet-linker/Steps/ManagedRegistrarLookupTablesStep.cs +++ b/tools/dotnet-linker/Steps/ManagedRegistrarLookupTablesStep.cs @@ -258,7 +258,7 @@ bool IsTrimmed (MemberReference type) void GenerateLookupTypeId (AssemblyTrampolineInfo infos, TypeDefinition registrarType, List types) { var lookupTypeMethod = registrarType.AddMethod ("LookupTypeId", MethodAttributes.Private | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.NewSlot | MethodAttributes.HideBySig, abr.System_UInt32); - var handleParameter = lookupTypeMethod.AddParameter ("handle", abr.System_RuntimeTypeHandle); + var handleParameter = lookupTypeMethod.AddParameter (abr.System_RuntimeTypeHandle); // handle lookupTypeMethod.Overrides.Add (abr.IManagedRegistrar_LookupTypeId); var body = lookupTypeMethod.CreateBody (out var il); @@ -295,7 +295,7 @@ void GenerateLookupTypeId (AssemblyTrampolineInfo infos, TypeDefinition registra void GenerateLookupType (AssemblyTrampolineInfo infos, TypeDefinition registrarType, List types) { var lookupTypeMethod = registrarType.AddMethod ("LookupType", MethodAttributes.Private | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.NewSlot | MethodAttributes.HideBySig, abr.System_RuntimeTypeHandle); - lookupTypeMethod.AddParameter ("id", abr.System_UInt32); + lookupTypeMethod.AddParameter (abr.System_UInt32); // id lookupTypeMethod.Overrides.Add (abr.IManagedRegistrar_LookupType); var body = lookupTypeMethod.CreateBody (out var il); @@ -337,8 +337,8 @@ void GenerateLookupType (AssemblyTrampolineInfo infos, TypeDefinition registrarT void GenerateConstructNSObject (TypeDefinition registrarType) { var createInstanceMethod = registrarType.AddMethod ("ConstructNSObject", MethodAttributes.Private | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.NewSlot | MethodAttributes.HideBySig, abr.ObjCRuntime_INativeObject); - var typeHandleParameter = createInstanceMethod.AddParameter ("typeHandle", abr.System_RuntimeTypeHandle); - var nativeHandleParameter = createInstanceMethod.AddParameter ("nativeHandle", abr.ObjCRuntime_NativeHandle); + var typeHandleParameter = createInstanceMethod.AddParameter (abr.System_RuntimeTypeHandle); // typeHandle + var nativeHandleParameter = createInstanceMethod.AddParameter (abr.ObjCRuntime_NativeHandle); // nativeHandle createInstanceMethod.Overrides.Add (abr.IManagedRegistrar_ConstructNSObject); var body = createInstanceMethod.CreateBody (out var il); @@ -394,9 +394,9 @@ void GenerateConstructNSObject (TypeDefinition registrarType) void GenerateConstructINativeObject (TypeDefinition registrarType) { var createInstanceMethod = registrarType.AddMethod ("ConstructINativeObject", MethodAttributes.Private | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.NewSlot | MethodAttributes.HideBySig, abr.ObjCRuntime_INativeObject); - var typeHandleParameter = createInstanceMethod.AddParameter ("typeHandle", abr.System_RuntimeTypeHandle); - var nativeHandleParameter = createInstanceMethod.AddParameter ("nativeHandle", abr.ObjCRuntime_NativeHandle); - var ownsParameter = createInstanceMethod.AddParameter ("owns", abr.System_Boolean); + var typeHandleParameter = createInstanceMethod.AddParameter (abr.System_RuntimeTypeHandle); // typeHandle + var nativeHandleParameter = createInstanceMethod.AddParameter (abr.ObjCRuntime_NativeHandle); // nativeHandle + var ownsParameter = createInstanceMethod.AddParameter (abr.System_Boolean); // owns createInstanceMethod.Overrides.Add (abr.IManagedRegistrar_ConstructINativeObject); var body = createInstanceMethod.CreateBody (out var il); @@ -471,7 +471,7 @@ void MarkConstructorIfTrimmed (MethodReference ctor) void GenerateRegisterWrapperTypes (TypeDefinition type) { var method = type.AddMethod ("RegisterWrapperTypes", MethodAttributes.Private | MethodAttributes.Final | MethodAttributes.Virtual | MethodAttributes.NewSlot | MethodAttributes.HideBySig, abr.System_Void); - method.AddParameter ("type", abr.System_Collections_Generic_Dictionary2.CreateGenericInstanceType (abr.System_RuntimeTypeHandle, abr.System_RuntimeTypeHandle)); + method.AddParameter (abr.System_Collections_Generic_Dictionary2.CreateGenericInstanceType (abr.System_RuntimeTypeHandle, abr.System_RuntimeTypeHandle)); // type method.Overrides.Add (abr.IManagedRegistrar_RegisterWrapperTypes); var body = method.CreateBody (out var il); @@ -523,8 +523,8 @@ void GenerateLookupUnmanagedFunction (TypeDefinition registrar_type, IList acti * } */ var createObjectMethod = proxyType.AddMethod ("CreateObject", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig, abr.ObjCRuntime_INativeObject); - createObjectMethod.AddParameter ("handle", abr.System_IntPtr); - createObjectMethod.AddParameter ("owns", abr.System_Boolean); + createObjectMethod.AddParameter (abr.System_IntPtr); // handle + createObjectMethod.AddParameter (abr.System_Boolean); // owns il = createObjectMethod.Body.GetILProcessor (); if (tr.ContainsGenericParameter) { EmitThrowCannotConstructGenericType (il, tr); @@ -484,7 +484,7 @@ void addPostAction (AssemblyDefinition assembly, Action acti * } */ var createObjectMethod = proxyType.AddMethod ("CreateObject", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig, abr.Foundation_NSObject); - createObjectMethod.AddParameter ("handle", abr.System_IntPtr); + createObjectMethod.AddParameter (abr.System_IntPtr); // handle il = createObjectMethod.Body.GetILProcessor (); if (td.ContainsGenericParameter) { EmitThrowCannotConstructGenericType (il, td); @@ -509,7 +509,7 @@ void addPostAction (AssemblyDefinition assembly, Action acti * } */ var getClassHandleMethod = proxyType.AddMethod ("GetClassHandle", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig, abr.System_IntPtr); - getClassHandleMethod.AddParameter ("is_custom_type", abr.System_Boolean.MakeByReferenceType ()); + getClassHandleMethod.AddParameter (abr.System_Boolean.MakeByReferenceType ()); // is_custom_type il = getClassHandleMethod.Body.GetILProcessor (); il.Append (il.Create (OpCodes.Ldarg_1)); il.Append (il.Create (isCustomType ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0)); @@ -530,7 +530,7 @@ void addPostAction (AssemblyDefinition assembly, Action acti * } */ var lookupUnmanagedFunctionMethod = proxyType.AddMethod ("LookupUnmanagedFunction", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig, abr.System_IntPtr); - lookupUnmanagedFunctionMethod.AddParameter ("name", abr.System_String); + lookupUnmanagedFunctionMethod.AddParameter (abr.System_String); // name il = lookupUnmanagedFunctionMethod.Body.GetILProcessor (); // Get all the UnmanagedCallersOnly methods we need to be able to find for the current type, which includes: @@ -628,8 +628,8 @@ void addPostAction (AssemblyDefinition assembly, Action acti * } */ var createObjectMethod = proxyType.AddMethod ("CreateObject", MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig, abr.ObjCRuntime_INativeObject); - createObjectMethod.AddParameter ("handle", abr.System_IntPtr); - createObjectMethod.AddParameter ("owns", abr.System_Boolean); + createObjectMethod.AddParameter (abr.System_IntPtr); // handle + createObjectMethod.AddParameter (abr.System_Boolean); // owns createObjectMethod.CreateBody (out il); var protocolWrapperType = objcType.ProtocolWrapperType.Resolve (); if (protocolWrapperType.ContainsGenericParameter) { From b3546950e257917dcda97b2fe39fd3208d50e7a1 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 5 Aug 2026 16:34:59 +0200 Subject: [PATCH 08/23] [docs] Improve XML docs for ten types (#26402) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve XML documentation for: - `NSZone` - `GLKMesh` - `MTKMesh` - `HMService` - `VTPropertyOptions` - `VTUtilities` - `INPriceRangeOption` - `INPriceRange` - `NSRunLoop` - `NSRunLoopModeExtensions` Each type is documented in a separate commit. The Cecil documentation baseline is updated for the newly documented `VTUtilities` API. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Foundation/NSRunLoop.cs | 14 ++++++-------- src/Foundation/NSZone.cs | 9 +++------ src/GLKit/GLKMesh.cs | 11 +++++------ src/HomeKit/HMService.cs | 14 ++++++-------- src/Intents/INPriceRange.cs | 11 +++++------ src/MetalKit/MTKMesh.cs | 13 ++++++------- src/VideoToolbox/VTPropertyOptions.cs | 10 ++++------ src/VideoToolbox/VTUtilities.cs | 13 +++++++------ tests/cecil-tests/Documentation.KnownFailures.txt | 1 - 9 files changed, 42 insertions(+), 54 deletions(-) diff --git a/src/Foundation/NSRunLoop.cs b/src/Foundation/NSRunLoop.cs index 8a21910f079f..28336d4aa074 100644 --- a/src/Foundation/NSRunLoop.cs +++ b/src/Foundation/NSRunLoop.cs @@ -26,15 +26,13 @@ namespace Foundation { public partial class NSRunLoop { - /// To be added. - /// To be added. + /// Stops the receiver's underlying run loop. public void Stop () { GetCFRunLoop ().Stop (); } - /// To be added. - /// To be added. + /// Wakes the receiver's underlying run loop. public void WakeUp () { GetCFRunLoop ().WakeUp (); @@ -44,10 +42,10 @@ public void WakeUp () static public partial class NSRunLoopModeExtensions { // this is a less common pattern so it's not automatically generated - /// The instance on which this method operates. - /// To be added. - /// To be added. - /// To be added. + /// Gets the native constants for a collection of run loop modes. + /// The run loop modes to convert. + /// The native constants corresponding to the specified run loop modes. + /// is . public static NSString [] GetConstants (this NSRunLoopMode [] self) { if (self is null) diff --git a/src/Foundation/NSZone.cs b/src/Foundation/NSZone.cs index f7e374bf14bf..442fa90c970d 100644 --- a/src/Foundation/NSZone.cs +++ b/src/Foundation/NSZone.cs @@ -8,7 +8,6 @@ namespace Foundation { // Helper to (mostly) support NS[Mutable]Copying protocols /// An OS-controlled area within memory from which objects are allocated. - /// To be added. [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("maccatalyst")] [SupportedOSPlatform ("macos")] @@ -36,9 +35,8 @@ internal NSZone (NativeHandle handle, bool owns) public NativeHandle Handle { get; private set; } #if !COREBUILD - /// To be added. - /// To be added. - /// To be added. + /// Gets or sets the name of the zone. + /// The zone name, or if the zone has no name. public string? Name { get { return CFString.FromHandle (NSZoneName (Handle)); @@ -54,8 +52,7 @@ public string? Name { } // note: Copy(NSZone) and MutableCopy(NSZone) with a nil pointer == default - /// To be added. - /// To be added. + /// The default memory allocation zone. public static readonly NSZone Default = new NSZone (NSDefaultMallocZone (), false); #endif } diff --git a/src/GLKit/GLKMesh.cs b/src/GLKit/GLKMesh.cs index 3b38e3d81682..177524677b5d 100644 --- a/src/GLKit/GLKMesh.cs +++ b/src/GLKit/GLKMesh.cs @@ -7,12 +7,11 @@ namespace GLKit { public partial class GLKMesh { - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. + /// Creates GLKit meshes from the meshes in a Model I/O asset. + /// The asset containing the source meshes. + /// The Model I/O meshes corresponding to the returned GLKit meshes. + /// On failure, contains an error that describes the problem. + /// The created GLKit meshes, or if they could not be created. public static GLKMesh []? FromAsset (MDLAsset asset, out MDLMesh []? sourceMeshes, out NSError? error) { var ret = FromAsset (asset, out NSArray? aret, out error); diff --git a/src/HomeKit/HMService.cs b/src/HomeKit/HMService.cs index f036aa32a268..26d85b0044d0 100644 --- a/src/HomeKit/HMService.cs +++ b/src/HomeKit/HMService.cs @@ -7,19 +7,17 @@ namespace HomeKit { public partial class HMService { #if !TVOS - /// To be added. - /// To be added. - /// Specifies that the device attached to a switch or outlet is of type . After the system sets the association, the system runs . - /// To be added. + /// Updates the type of device associated with the service. + /// The associated service type. + /// The handler to invoke after the update completes. public void UpdateAssociatedServiceType (HMServiceType serviceType, Action completion) { UpdateAssociatedServiceType (serviceType.GetConstant (), completion); } - /// To be added. - /// Asynchronously updates the associated service type to - /// To be added. - /// To be added. + /// Asynchronously updates the type of device associated with the service. + /// The associated service type. + /// A task that represents the update operation. public Task UpdateAssociatedServiceTypeAsync (HMServiceType serviceType) { return UpdateAssociatedServiceTypeAsync (serviceType.GetConstant ()); diff --git a/src/Intents/INPriceRange.cs b/src/Intents/INPriceRange.cs index 2c8ea831c471..429a2436f1e8 100644 --- a/src/Intents/INPriceRange.cs +++ b/src/Intents/INPriceRange.cs @@ -13,7 +13,6 @@ namespace Intents { /// Enumerates the minimum and maximum values of a price range. - /// To be added. public enum INPriceRangeOption { /// The greatest price. Maximum, @@ -23,11 +22,11 @@ public enum INPriceRangeOption { public partial class INPriceRange { - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. + /// Creates a price range with either a minimum or maximum price. + /// Whether is the minimum or maximum price. + /// The price at the selected range boundary. + /// The ISO 4217 currency code for . + /// is not a valid value. public INPriceRange (INPriceRangeOption option, NSDecimalNumber price, string currencyCode) : base (NSObjectFlag.Empty) { diff --git a/src/MetalKit/MTKMesh.cs b/src/MetalKit/MTKMesh.cs index 9eb1340ee9b0..c74f4a3c23ee 100644 --- a/src/MetalKit/MTKMesh.cs +++ b/src/MetalKit/MTKMesh.cs @@ -9,13 +9,12 @@ namespace MetalKit { public partial class MTKMesh { - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// Creates and returns a new Metal Kit mesh from the supplied Model IO asset. - /// To be added. - /// To be added. + /// Creates MetalKit meshes from the meshes in a Model I/O asset. + /// The asset containing the source meshes. + /// The Metal device on which to create the mesh resources. + /// The Model I/O meshes corresponding to the returned MetalKit meshes. + /// On failure, contains an error that describes the problem. + /// The created MetalKit meshes, or if they could not be created. public static MTKMesh []? FromAsset (MDLAsset asset, IMTLDevice device, out MDLMesh []? sourceMeshes, out NSError error) { NSArray aret; diff --git a/src/VideoToolbox/VTPropertyOptions.cs b/src/VideoToolbox/VTPropertyOptions.cs index aa6f5b333a60..6fdfd5c5900d 100644 --- a/src/VideoToolbox/VTPropertyOptions.cs +++ b/src/VideoToolbox/VTPropertyOptions.cs @@ -17,9 +17,8 @@ namespace VideoToolbox { public partial class VTPropertyOptions { - /// To be added. - /// To be added. - /// To be added. + /// Gets or sets the property's value type. + /// The property value type. public VTPropertyType Type { get { var key = GetNSStringValue (VTPropertyKeys.Type); @@ -52,9 +51,8 @@ public VTPropertyType Type { } } - /// To be added. - /// To be added. - /// To be added. + /// Gets or sets whether the property can be read or written. + /// The property's read/write status. public VTReadWriteStatus ReadWriteStatus { get { var key = GetNSStringValue (VTPropertyKeys.ReadWriteStatus); diff --git a/src/VideoToolbox/VTUtilities.cs b/src/VideoToolbox/VTUtilities.cs index 6efe86d3a90e..7bdcc6af1fc1 100644 --- a/src/VideoToolbox/VTUtilities.cs +++ b/src/VideoToolbox/VTUtilities.cs @@ -15,7 +15,6 @@ namespace VideoToolbox { /// Extensions class for . - /// To be added. [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios")] [SupportedOSPlatform ("tvos")] @@ -30,11 +29,11 @@ unsafe extern static VTStatus VTCreateCGImageFromCVPixelBuffer ( // intentionally not exposing the (NSDictionary options) argument // since header docs indicate that there are no options available // as of 9.0/10.11 and to always pass NULL - /// To be added. - /// To be added. - /// To be added. - /// To be added. - /// To be added. + /// Creates a Core Graphics image from a pixel buffer. + /// The pixel buffer to convert. + /// On success, the created image; otherwise, . + /// A status code that indicates whether the conversion succeeded. + /// is . public static VTStatus ToCGImage (this CVPixelBuffer pixelBuffer, out CGImage? image) { if (pixelBuffer is null) @@ -61,6 +60,8 @@ public static VTStatus ToCGImage (this CVPixelBuffer pixelBuffer, out CGImage? i [DllImport (Constants.VideoToolboxLibrary)] static extern void VTRegisterSupplementalVideoDecoderIfAvailable (uint codecType); + /// Registers the supplemental video decoder for a codec if one is available. + /// The video codec for which to register a supplemental decoder. [SupportedOSPlatform ("macos")] [SupportedOSPlatform ("ios26.4")] [SupportedOSPlatform ("tvos26.4")] diff --git a/tests/cecil-tests/Documentation.KnownFailures.txt b/tests/cecil-tests/Documentation.KnownFailures.txt index 3382c8a41590..e86992151ea9 100644 --- a/tests/cecil-tests/Documentation.KnownFailures.txt +++ b/tests/cecil-tests/Documentation.KnownFailures.txt @@ -15835,7 +15835,6 @@ M:VideoToolbox.VTSuperResolutionScalerParameters.#ctor(VideoToolbox.VTFrameProce M:VideoToolbox.VTSupportedEncoderProperties.#ctor M:VideoToolbox.VTTemporalNoiseFilterConfiguration.#ctor(System.IntPtr,System.IntPtr,CoreMedia.CMPixelFormat) M:VideoToolbox.VTTemporalNoiseFilterParameters.#ctor(VideoToolbox.VTFrameProcessorFrame,VideoToolbox.VTFrameProcessorFrame[],VideoToolbox.VTFrameProcessorFrame[],VideoToolbox.VTFrameProcessorFrame,System.Single,System.Byte) -M:VideoToolbox.VTUtilities.RegisterSupplementalVideoDecoder(CoreMedia.CMVideoCodecType) M:Vision.VNDetectBarcodesRequest.GetSupportedSymbologies(Foundation.NSError@) M:Vision.VNFeaturePrintObservation.ComputeDistance(System.Single[]@,Vision.VNFeaturePrintObservation,Foundation.NSError@) M:Vision.VNGenerateOpticalFlowRequest.#ctor(CoreGraphics.CGImage,ImageIO.CGImagePropertyOrientation,Vision.VNImageOptions,Vision.VNRequestCompletionHandler) From 55c5ceec2052a156616a784a340877d0b0f9ee11 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 5 Aug 2026 17:22:52 +0200 Subject: [PATCH 09/23] [tests] Update expected sizes. --- ...lyst-CoreCLR-Interpreter-preservedapis.txt | 8 +++++-- .../MacCatalyst-CoreCLR-R2R-preservedapis.txt | 8 +++++-- ...atalyst-NativeAOT-TrimmableStatic-size.txt | 6 ++--- .../expected/MacCatalyst-NativeAOT-size.txt | 8 +++---- ...reCLR-Interpreter-TrimmableStatic-size.txt | 16 ++++++------- .../MacOSX-CoreCLR-Interpreter-size.txt | 10 ++++---- .../expected/MacOSX-CoreCLR-R2R-size.txt | 8 +++---- .../MacOSX-NativeAOT-TrimmableStatic-size.txt | 6 ++--- .../expected/MacOSX-NativeAOT-size.txt | 8 +++---- ...TVOS-CoreCLR-Interpreter-preservedapis.txt | 24 +++++++++++-------- .../TVOS-CoreCLR-R2R-preservedapis.txt | 24 +++++++++++-------- .../TVOS-NativeAOT-TrimmableStatic-size.txt | 6 ++--- .../expected/TVOS-NativeAOT-size.txt | 8 +++---- .../iOS-CoreCLR-Interpreter-preservedapis.txt | 8 +++++-- .../iOS-CoreCLR-R2R-preservedapis.txt | 8 +++++-- .../iOS-NativeAOT-TrimmableStatic-size.txt | 6 ++--- .../UnitTests/expected/iOS-NativeAOT-size.txt | 8 +++---- 17 files changed, 97 insertions(+), 73 deletions(-) diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-Interpreter-preservedapis.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-Interpreter-preservedapis.txt index 2d7e78c7deb8..3f7562da28c3 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-Interpreter-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-Interpreter-preservedapis.txt @@ -18,11 +18,12 @@ Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRunti Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/<>O -Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.MacCatalyst.dll:CoreFoundation.CFObject Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -368,6 +369,7 @@ Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.D Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -952,7 +954,7 @@ Microsoft.MacCatalyst.dll:System.Collections.Generic.List`1 ObjCR Microsoft.MacCatalyst.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.MacCatalyst.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.MacCatalyst.dll:System.Func`3 ObjCRuntime.Runtime/<>O::<1>__ResolvingEventHandler Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state @@ -981,6 +983,8 @@ Microsoft.MacCatalyst.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.MacCatalyst.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.MacCatalyst.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.MacCatalyst.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-R2R-preservedapis.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-R2R-preservedapis.txt index 2d7e78c7deb8..3f7562da28c3 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-R2R-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-CoreCLR-R2R-preservedapis.txt @@ -18,11 +18,12 @@ Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRunti Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/<>O -Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.MacCatalyst.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.MacCatalyst.dll:CoreFoundation.CFObject Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.MacCatalyst.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -368,6 +369,7 @@ Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.D Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode Microsoft.MacCatalyst.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -952,7 +954,7 @@ Microsoft.MacCatalyst.dll:System.Collections.Generic.List`1 ObjCR Microsoft.MacCatalyst.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.MacCatalyst.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.MacCatalyst.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.MacCatalyst.dll:System.Func`3 ObjCRuntime.Runtime/<>O::<1>__ResolvingEventHandler Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.MacCatalyst.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state @@ -981,6 +983,8 @@ Microsoft.MacCatalyst.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.MacCatalyst.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.MacCatalyst.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.MacCatalyst.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.MacCatalyst.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt index 2ef9448cb7ed..aaa5bcf6096f 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 8,528,060 bytes (8,328.2 KB = 8.1 MB) +AppBundleSize: 7,964,293 bytes (7,777.6 KB = 7.6 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 1,060 bytes (1.0 KB = 0.0 MB) + 1,069 bytes (1.0 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 8,525,096 bytes (8,325.3 KB = 8.1 MB) + 7,961,320 bytes (7,774.7 KB = 7.6 MB) Contents/MonoBundle/runtimeconfig.bin: 1,896 bytes (1.9 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt index abbca176d351..aaa5bcf6096f 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 2,513,124 bytes (2,454.2 KB = 2.4 MB) +AppBundleSize: 7,964,293 bytes (7,777.6 KB = 7.6 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 1,060 bytes (1.0 KB = 0.0 MB) + 1,069 bytes (1.0 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 2,510,248 bytes (2,451.4 KB = 2.4 MB) + 7,961,320 bytes (7,774.7 KB = 7.6 MB) Contents/MonoBundle/runtimeconfig.bin: - 1,808 bytes (1.8 KB = 0.0 MB) + 1,896 bytes (1.9 KB = 0.0 MB) Contents/PkgInfo: 8 bytes (0.0 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt index 3c14d9663169..df9817923630 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt @@ -1,15 +1,15 @@ -AppBundleSize: 255,589,088 bytes (249,598.7 KB = 243.7 MB) +AppBundleSize: 254,884,704 bytes (248,910.8 KB = 243.1 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: 747 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 7,351,000 bytes (7,178.7 KB = 7.0 MB) + 7,351,128 bytes (7,178.8 KB = 7.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/_Microsoft.macOS.TypeMap.dll: - 4,913,152 bytes (4,798.0 KB = 4.7 MB) + 4,776,960 bytes (4,665.0 KB = 4.6 MB) Contents/MonoBundle/.xamarin/osx-arm64/_Microsoft.macOS.TypeMaps.dll: 2,048 bytes (2.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/_SizeTestApp.TypeMap.dll: - 3,584 bytes (3.5 KB = 0.0 MB) + 3,072 bytes (3.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.CSharp.dll: 872,960 bytes (852.5 KB = 0.8 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Extensions.Caching.Abstractions.dll: @@ -31,7 +31,7 @@ Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Extensions.Options.dll: Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Extensions.Primitives.dll: 75,776 bytes (74.0 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.macOS.dll: - 36,876,288 bytes (36,012.0 KB = 35.2 MB) + 36,660,736 bytes (35,801.5 KB = 35.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.Core.dll: 1,326,592 bytes (1,295.5 KB = 1.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Win32.Registry.dll: @@ -217,11 +217,11 @@ Contents/MonoBundle/.xamarin/osx-arm64/System.Web.HttpUtility.dll: Contents/MonoBundle/.xamarin/osx-arm64/System.Xml.XPath.XDocument.dll: 7,168 bytes (7.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/_Microsoft.macOS.TypeMap.dll: - 4,913,152 bytes (4,798.0 KB = 4.7 MB) + 4,776,960 bytes (4,665.0 KB = 4.6 MB) Contents/MonoBundle/.xamarin/osx-x64/_Microsoft.macOS.TypeMaps.dll: 2,048 bytes (2.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/_SizeTestApp.TypeMap.dll: - 3,584 bytes (3.5 KB = 0.0 MB) + 3,072 bytes (3.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.CSharp.dll: 791,552 bytes (773.0 KB = 0.8 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Extensions.Caching.Abstractions.dll: @@ -243,7 +243,7 @@ Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Extensions.Options.dll: Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Extensions.Primitives.dll: 69,632 bytes (68.0 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.macOS.dll: - 36,876,288 bytes (36,012.0 KB = 35.2 MB) + 36,660,736 bytes (35,801.5 KB = 35.0 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.Core.dll: 1,181,696 bytes (1,154.0 KB = 1.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Win32.Registry.dll: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt index 5c31f2766be3..098b72b5d3fc 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 246,469,150 bytes (240,692.5 KB = 235.1 MB) +AppBundleSize: 246,031,902 bytes (240,265.5 KB = 234.6 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: 747 bytes (0.7 KB = 0.0 MB) @@ -25,13 +25,13 @@ Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Extensions.Options.dll: Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Extensions.Primitives.dll: 75,776 bytes (74.0 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.macOS.dll: - 36,913,152 bytes (36,048.0 KB = 35.2 MB) + 36,695,040 bytes (35,835.0 KB = 35.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.Core.dll: 1,326,592 bytes (1,295.5 KB = 1.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Win32.Registry.dll: 23,552 bytes (23.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/SizeTestApp.dll: - 6,656 bytes (6.5 KB = 0.0 MB) + 6,144 bytes (6.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/System.Collections.Concurrent.dll: 135,680 bytes (132.5 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-arm64/System.Collections.dll: @@ -231,13 +231,13 @@ Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Extensions.Options.dll: Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Extensions.Primitives.dll: 69,632 bytes (68.0 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.macOS.dll: - 36,913,152 bytes (36,048.0 KB = 35.2 MB) + 36,695,040 bytes (35,835.0 KB = 35.0 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.Core.dll: 1,181,696 bytes (1,154.0 KB = 1.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Win32.Registry.dll: 23,040 bytes (22.5 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/SizeTestApp.dll: - 6,656 bytes (6.5 KB = 0.0 MB) + 6,144 bytes (6.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-x64/System.Collections.Concurrent.dll: 122,368 bytes (119.5 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-x64/System.Collections.dll: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-R2R-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-R2R-size.txt index 5f63c90ebe9a..f4803f806944 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-R2R-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-R2R-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 316,218,910 bytes (308,807.5 KB = 301.6 MB) +AppBundleSize: 315,779,102 bytes (308,378.0 KB = 301.2 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: 747 bytes (0.7 KB = 0.0 MB) @@ -25,13 +25,13 @@ Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Extensions.Options.dll: Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Extensions.Primitives.dll: 75,776 bytes (74.0 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.macOS.dll: - 77,182,464 bytes (75,373.5 KB = 73.6 MB) + 76,961,792 bytes (75,158.0 KB = 73.4 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.VisualBasic.Core.dll: 1,326,592 bytes (1,295.5 KB = 1.3 MB) Contents/MonoBundle/.xamarin/osx-arm64/Microsoft.Win32.Registry.dll: 23,552 bytes (23.0 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/SizeTestApp.dll: - 10,240 bytes (10.0 KB = 0.0 MB) + 9,728 bytes (9.5 KB = 0.0 MB) Contents/MonoBundle/.xamarin/osx-arm64/System.Collections.Concurrent.dll: 135,680 bytes (132.5 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-arm64/System.Collections.dll: @@ -231,7 +231,7 @@ Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Extensions.Options.dll: Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Extensions.Primitives.dll: 69,632 bytes (68.0 KB = 0.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.macOS.dll: - 66,386,944 bytes (64,831.0 KB = 63.3 MB) + 66,168,320 bytes (64,617.5 KB = 63.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.VisualBasic.Core.dll: 1,181,696 bytes (1,154.0 KB = 1.1 MB) Contents/MonoBundle/.xamarin/osx-x64/Microsoft.Win32.Registry.dll: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt index 5c0d34165365..d5dae8cbfbfe 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 18,044,314 bytes (17,621.4 KB = 17.2 MB) +AppBundleSize: 17,120,691 bytes (16,719.4 KB = 16.3 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 738 bytes (0.7 KB = 0.0 MB) + 747 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 18,041,720 bytes (17,618.9 KB = 17.2 MB) + 17,118,088 bytes (16,716.9 KB = 16.3 MB) Contents/MonoBundle/runtimeconfig.bin: 1,848 bytes (1.8 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt index a693d82dbbb2..d5dae8cbfbfe 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 5,359,080 bytes (5,233.5 KB = 5.1 MB) +AppBundleSize: 17,120,691 bytes (16,719.4 KB = 16.3 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: - 738 bytes (0.7 KB = 0.0 MB) + 747 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 5,356,568 bytes (5,231.0 KB = 5.1 MB) + 17,118,088 bytes (16,716.9 KB = 16.3 MB) Contents/MonoBundle/runtimeconfig.bin: - 1,766 bytes (1.7 KB = 0.0 MB) + 1,848 bytes (1.8 KB = 0.0 MB) Contents/PkgInfo: 8 bytes (0.0 KB = 0.0 MB) diff --git a/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-Interpreter-preservedapis.txt b/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-Interpreter-preservedapis.txt index 5ab588511098..02c3c93910de 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-Interpreter-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-Interpreter-preservedapis.txt @@ -10,11 +10,12 @@ Microsoft.tvOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nati Microsoft.tvOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.tvOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray/<>O -Microsoft.tvOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.tvOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.tvOS.dll:CoreFoundation.CFObject Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -58,13 +59,13 @@ Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher..ctor() Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2640_Foundation_NSAsyncDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) -Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2641_Foundation_NSAsyncDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2642_Foundation_NSAsyncDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2643_Foundation_NSAsyncDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher..ctor(System.Threading.SendOrPostCallback, System.Object) Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2643_Foundation_NSAsyncSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2645_Foundation_NSAsyncSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSAutoreleasePool Microsoft.tvOS.dll:Foundation.NSAutoreleasePool._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:Foundation.NSAutoreleasePool._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) @@ -109,8 +110,8 @@ Microsoft.tvOS.dll:Foundation.NSDispatcher Microsoft.tvOS.dll:Foundation.NSDispatcher..ctor() Microsoft.tvOS.dll:Foundation.NSDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2635_Foundation_NSDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) -Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2636_Foundation_NSDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2637_Foundation_NSDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2638_Foundation_NSDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSException Microsoft.tvOS.dll:Foundation.NSException ObjCRuntime.MarshalObjectiveCExceptionEventArgs::k__BackingField Microsoft.tvOS.dll:Foundation.NSException ObjCRuntime.MarshalObjectiveCExceptionEventArgs::Exception() @@ -213,7 +214,7 @@ Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Add(Foundation.NSObject Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Drain(Foundation.NSObject) Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.ScheduleDrain() Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2669_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2671_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::HasManagedRef Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::InitialSet @@ -251,7 +252,7 @@ Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher..ctor(System.Threading.SendOrPostCallback, System.Object) Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2638_Foundation_NSSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2640_Foundation_NSSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSValue Microsoft.tvOS.dll:Foundation.NSValue._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:Foundation.NSValue._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) @@ -361,6 +362,7 @@ Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mo Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -944,7 +946,7 @@ Microsoft.tvOS.dll:System.Collections.Generic.List`1 ObjCRuntime. Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.tvOS.dll:System.Func`3 ObjCRuntime.Runtime/<>O::<1>__ResolvingEventHandler Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state @@ -974,6 +976,8 @@ Microsoft.tvOS.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.tvOS.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.tvOS.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.tvOS.dll:System.IntPtr Foundation.NSObject::__data @@ -1171,7 +1175,7 @@ Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(System.IntPtr, ObjCRuntime.IManagedRegistrar) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate.FinishedLaunching(UIKit.UIApplication, Foundation.NSDictionary) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__ -Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_359_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_361_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) Microsoft.tvOS.dll:UIKit.UIButton Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) diff --git a/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-R2R-preservedapis.txt b/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-R2R-preservedapis.txt index 5ab588511098..02c3c93910de 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-R2R-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-CoreCLR-R2R-preservedapis.txt @@ -10,11 +10,12 @@ Microsoft.tvOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nati Microsoft.tvOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.tvOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.tvOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:CoreFoundation.CFArray/<>O -Microsoft.tvOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.tvOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.tvOS.dll:CoreFoundation.CFObject Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.tvOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -58,13 +59,13 @@ Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher..ctor() Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2640_Foundation_NSAsyncDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) -Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2641_Foundation_NSAsyncDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2642_Foundation_NSAsyncDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSAsyncDispatcher/__Registrar_Callbacks__.callback_2643_Foundation_NSAsyncDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher..ctor(System.Threading.SendOrPostCallback, System.Object) Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2643_Foundation_NSAsyncSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSAsyncSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2645_Foundation_NSAsyncSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSAutoreleasePool Microsoft.tvOS.dll:Foundation.NSAutoreleasePool._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:Foundation.NSAutoreleasePool._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) @@ -109,8 +110,8 @@ Microsoft.tvOS.dll:Foundation.NSDispatcher Microsoft.tvOS.dll:Foundation.NSDispatcher..ctor() Microsoft.tvOS.dll:Foundation.NSDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2635_Foundation_NSDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) -Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2636_Foundation_NSDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2637_Foundation_NSDispatcher__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSDispatcher/__Registrar_Callbacks__.callback_2638_Foundation_NSDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSException Microsoft.tvOS.dll:Foundation.NSException ObjCRuntime.MarshalObjectiveCExceptionEventArgs::k__BackingField Microsoft.tvOS.dll:Foundation.NSException ObjCRuntime.MarshalObjectiveCExceptionEventArgs::Exception() @@ -213,7 +214,7 @@ Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Add(Foundation.NSObject Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.Drain(Foundation.NSObject) Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer.ScheduleDrain() Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2669_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSObject/NSObject_Disposer/__Registrar_Callbacks__.callback_2671_Foundation_NSObject_NSObject_Disposer_Drain(System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::HasManagedRef Microsoft.tvOS.dll:Foundation.NSObject/XamarinGCHandleFlags Foundation.NSObject/XamarinGCHandleFlags::InitialSet @@ -251,7 +252,7 @@ Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher..ctor(System.Threading.SendOrPostCallback, System.Object) Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher.Apply() Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher/__Registrar_Callbacks__ -Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2638_Foundation_NSSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) +Microsoft.tvOS.dll:Foundation.NSSynchronizationContextDispatcher/__Registrar_Callbacks__.callback_2640_Foundation_NSSynchronizationContextDispatcher_Apply(System.IntPtr, System.IntPtr, System.IntPtr*) Microsoft.tvOS.dll:Foundation.NSValue Microsoft.tvOS.dll:Foundation.NSValue._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:Foundation.NSValue._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) @@ -361,6 +362,7 @@ Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mo Microsoft.tvOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.tvOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -944,7 +946,7 @@ Microsoft.tvOS.dll:System.Collections.Generic.List`1 ObjCRuntime. Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.tvOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.tvOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.tvOS.dll:System.Func`3 ObjCRuntime.Runtime/<>O::<1>__ResolvingEventHandler Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.tvOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state @@ -974,6 +976,8 @@ Microsoft.tvOS.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.tvOS.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.tvOS.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.tvOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.tvOS.dll:System.IntPtr Foundation.NSObject::__data @@ -1171,7 +1175,7 @@ Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(ObjCRuntime.NativeHandle) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate..ctor(System.IntPtr, ObjCRuntime.IManagedRegistrar) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate.FinishedLaunching(UIKit.UIApplication, Foundation.NSDictionary) Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__ -Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_359_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) +Microsoft.tvOS.dll:UIKit.UIApplicationDelegate/__Registrar_Callbacks__.callback_361_UIKit_UIApplicationDelegate__ctor(System.IntPtr, System.IntPtr, System.Byte*, System.IntPtr*) Microsoft.tvOS.dll:UIKit.UIButton Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructINativeObject(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.tvOS.dll:UIKit.UIButton._Xamarin_ConstructNSObject(ObjCRuntime.NativeHandle) diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt index 1723049f94c9..ebd8d392bd3e 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 7,604,759 bytes (7,426.5 KB = 7.3 MB) +AppBundleSize: 7,095,392 bytes (6,929.1 KB = 6.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,126 bytes (1.1 KB = 0.0 MB) + 1,135 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,889 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 7,601,736 bytes (7,423.6 KB = 7.2 MB) + 7,092,360 bytes (6,926.1 KB = 6.8 MB) diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt index 40642fd1cafb..ebd8d392bd3e 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 2,476,694 bytes (2,418.6 KB = 2.4 MB) +AppBundleSize: 7,095,392 bytes (6,929.1 KB = 6.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,126 bytes (1.1 KB = 0.0 MB) + 1,135 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: - 1,808 bytes (1.8 KB = 0.0 MB) + 1,889 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 2,473,752 bytes (2,415.8 KB = 2.4 MB) + 7,092,360 bytes (6,926.1 KB = 6.8 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-preservedapis.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-preservedapis.txt index 598773ede0e2..ffe5c3348e5d 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-preservedapis.txt @@ -10,11 +10,12 @@ Microsoft.iOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nativ Microsoft.iOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.iOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray/<>O -Microsoft.iOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.iOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.iOS.dll:CoreFoundation.CFObject Microsoft.iOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -361,6 +362,7 @@ Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mod Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -944,7 +946,7 @@ Microsoft.iOS.dll:System.Collections.Generic.List`1 ObjCRuntime.R Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.iOS.dll:System.Func`3 ObjCRuntime.Runtime/<>O::<1>__ResolvingEventHandler Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state @@ -974,6 +976,8 @@ Microsoft.iOS.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.iOS.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.iOS.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.iOS.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-preservedapis.txt b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-preservedapis.txt index 598773ede0e2..ffe5c3348e5d 100644 --- a/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-preservedapis.txt +++ b/tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-preservedapis.txt @@ -10,11 +10,12 @@ Microsoft.iOS.dll:CoreFoundation.CFArray.ArrayFromHandleFunc`1(ObjCRuntime.Nativ Microsoft.iOS.dll:CoreFoundation.CFArray.CFArrayGetValues(System.IntPtr, CoreFoundation.CFRange, System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.DefaultConvert`1(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFNullHandle() +Microsoft.iOS.dll:CoreFoundation.CFArray.get__CFTypeArrayCallbacks() Microsoft.iOS.dll:CoreFoundation.CFArray.GetCount(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle, System.Boolean) Microsoft.iOS.dll:CoreFoundation.CFArray.StringArrayFromHandle(ObjCRuntime.NativeHandle) Microsoft.iOS.dll:CoreFoundation.CFArray/<>O -Microsoft.iOS.dll:CoreFoundation.CFArray/O__25_0`1 +Microsoft.iOS.dll:CoreFoundation.CFArray/O__23_0`1 Microsoft.iOS.dll:CoreFoundation.CFObject Microsoft.iOS.dll:CoreFoundation.CFObject.CFRelease(System.IntPtr) Microsoft.iOS.dll:CoreFoundation.CFObject.CFRetain(System.IntPtr) @@ -361,6 +362,7 @@ Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.IntPtr, ObjCRuntime.Dlfcn/Mod Microsoft.iOS.dll:ObjCRuntime.Dlfcn._dlopen(System.String, ObjCRuntime.Dlfcn/Mode) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.IntPtr) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.dlsym(System.IntPtr, System.String) +Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIndirect(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn.GetIntPtr(System.IntPtr, System.String) Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode Microsoft.iOS.dll:ObjCRuntime.Dlfcn/Mode ObjCRuntime.Dlfcn/Mode::First @@ -944,7 +946,7 @@ Microsoft.iOS.dll:System.Collections.Generic.List`1 ObjCRuntime.R Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::k__BackingField Microsoft.iOS.dll:System.Exception ObjCRuntime.MarshalManagedExceptionEventArgs::Exception() Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/<>O::<0>__FromHandle -Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__25_0`1::<0>__DefaultConvert +Microsoft.iOS.dll:System.Func`2 CoreFoundation.CFArray/O__23_0`1::<0>__DefaultConvert Microsoft.iOS.dll:System.Func`3 ObjCRuntime.Runtime/<>O::<1>__ResolvingEventHandler Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary::System.Collections.Generic.ICollection>.Count() Microsoft.iOS.dll:System.Int32 Foundation.NSDictionary/d__66::<>1__state @@ -974,6 +976,8 @@ Microsoft.iOS.dll:System.Int32 ObjCRuntime.RuntimeException::Code() Microsoft.iOS.dll:System.Int32 ObjCRuntime.TransientString/Encoding::value__ Microsoft.iOS.dll:System.Int64 Foundation.NSComparisonResult::value__ Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFNullHandle() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::_CFTypeArrayCallbacks() +Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFArray::kCFTypeArrayCallbacks_ptr Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::len Microsoft.iOS.dll:System.IntPtr CoreFoundation.CFRange::loc Microsoft.iOS.dll:System.IntPtr Foundation.NSObject::__data diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt index 6faf492bf292..17b9e545222b 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 8,790,950 bytes (8,584.9 KB = 8.4 MB) +AppBundleSize: 8,219,303 bytes (8,026.7 KB = 7.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,150 bytes (1.1 KB = 0.0 MB) + 1,159 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: 1,888 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 8,787,904 bytes (8,581.9 KB = 8.4 MB) + 8,216,248 bytes (8,023.7 KB = 7.8 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt index aabe8b98a8c5..17b9e545222b 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt @@ -1,10 +1,10 @@ -AppBundleSize: 2,510,182 bytes (2,451.3 KB = 2.4 MB) +AppBundleSize: 8,219,303 bytes (8,026.7 KB = 7.8 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: - 1,150 bytes (1.1 KB = 0.0 MB) + 1,159 bytes (1.1 KB = 0.0 MB) PkgInfo: 8 bytes (0.0 KB = 0.0 MB) runtimeconfig.bin: - 1,808 bytes (1.8 KB = 0.0 MB) + 1,888 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 2,507,216 bytes (2,448.5 KB = 2.4 MB) + 8,216,248 bytes (8,023.7 KB = 7.8 MB) From 301fbb161610431a32bdfe76ff7bc5de21829527 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 5 Aug 2026 17:38:06 +0200 Subject: [PATCH 10/23] [registrar] Look up trimmed-away protocol interface methods in the pre-trim assemblies. (#26403) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The static registrar needs the protocol interface methods to figure out which selector an implicit protocol implementation should be registered with (the implementing method typically has no `[Export]` attribute of its own): ```csharp class MyDataSource : NSObject, IUITableViewDataSource { // No [Export] here - the selector comes from IUITableViewDataSource.RowsInSection public nint RowsInSection (UITableView tableView, nint section) => 1; } ``` The trimmer removes these interface methods, so `CollectUnmarkedMembersSubStep` stores them in the `DerivedLinkContext` for the registrar to use later. That handoff is in-memory, so it only works when the registrar runs in the same process as the trimmer - which isn't the case when post-processing assemblies. The result was that no selector was registered at all for implicit protocol implementations in that flow, and calling the method from Objective-C failed with `unrecognized selector sent to instance`. Look the missing methods up in the pre-trim assemblies instead, which we already have access to when post-processing assemblies (`GetProtocolMemberAttributes` already uses them to read `[ProtocolMember]` attributes that have been trimmed away). ### Testing Verified on a branch where the trimmable-static registrar is the default for CoreCLR. 🤖 Pull request created by Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../xharness/Jenkins/TestVariationsFactory.cs | 6 +++ tools/common/StaticRegistrar.cs | 53 +++++++++++++++---- .../Steps/ManagedRegistrarStep.cs | 5 +- 3 files changed, 53 insertions(+), 11 deletions(-) diff --git a/tests/xharness/Jenkins/TestVariationsFactory.cs b/tests/xharness/Jenkins/TestVariationsFactory.cs index 2309471f1786..a96ae74fe293 100644 --- a/tests/xharness/Jenkins/TestVariationsFactory.cs +++ b/tests/xharness/Jenkins/TestVariationsFactory.cs @@ -96,6 +96,12 @@ IEnumerable GetTestData (RunTestTask test) yield return new TestData { Variation = "Release (link sdk)", TestVariation = "release|linksdk", Ignored = ignore }; yield return new TestData { Variation = "Release (link all)", TestVariation = "release|linkall", Ignored = ignore }; yield return new TestData { Variation = $"{test.ProjectConfiguration} (PrepareAssemblies)", TestVariation = "prepare-assemblies", Ignored = ignore }; + // With PrepareAssemblies the registrar runs in a separate process after the trimmer, so it + // can't get any information from the trimmer directly, and has to look up trimmed-away + // metadata in the pre-trim assemblies instead. Enable the trimmer (linksdk), because + // otherwise nothing is trimmed away and none of this is exercised. + if (supports_coreclr) + yield return new TestData { Variation = $"{test.ProjectConfiguration} (PrepareAssemblies, Trimmable Static Registrar, link sdk)", TestVariation = "linksdk|prepare-assemblies|trimmable-static-registrar", Ignored = ignore }; // Explicitly disable the trimmer (dontlink) and enable InlineDlfcnMethods together with // PrepareAssemblies to exercise the inlined-dlfcn native symbol generation when the trimmer // is skipped. On .NET 11+ this is already covered by the plain 'prepare-assemblies' variation diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index de28115c9bd0..7d25573bb23c 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -390,13 +390,21 @@ void CollectInterfaces ([NotNullIfNotNull (nameof (ifaces))] ref List v.FullName == imethod.FullName)) iface_methods.Add (imethod); } +#endif } // We only care about implementators declared in 'type'. @@ -408,13 +416,21 @@ void CollectInterfaces ([NotNullIfNotNull (nameof (ifaces))] ref List v.FullName == ifaceMethod.FullName); + } - AddMethodMapping (ref rv, impl, ifaceMethodDef); + if (ifaceMethodDef is null) { + // The type may implement interfaces which aren't protocol interfaces, so this is OK. + continue; } + + iface_methods.Remove (ifaceMethodDef); + + AddMethodMapping (ref rv, impl, ifaceMethodDef); } } @@ -1534,6 +1550,23 @@ protected override string PlatformName { return result; } +#if ASSEMBLY_PREPARER + // Returns the methods the given type had before it was trimmed. Returns an empty enumerable if the + // pre-trim assemblies aren't available (which is the case unless we're post-processing assemblies). + IEnumerable GetPreTrimMethods (TypeDefinition type) + { + if (!App.IsPostProcessingAssemblies || App.PreTrimAssemblyResolver is null) + return []; + + var preTrimAssembly = App.PreTrimAssemblyResolver.Resolve (type.Module.Assembly.Name); + var preTrimType = preTrimAssembly?.MainModule.GetType (type.FullName); + if (preTrimType is null || !preTrimType.HasMethods) + return []; + + return preTrimType.Methods; + } +#endif + protected override IEnumerable GetProtocolMemberAttributes (TypeReference type) { var td = type.Resolve (); diff --git a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs index 76c6be5055c9..f5ac49742cc2 100644 --- a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs +++ b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs @@ -237,7 +237,10 @@ bool ProcessType (TypeDefinition type, AssemblyTrampolineInfo infos, List Date: Wed, 5 Aug 2026 18:21:43 +0200 Subject: [PATCH 11/23] [dotnet-linker] Set AssociatedSourceType on UnmanagedCallersOnly trampolines. Fixes #25631. Set the AssociatedSourceType field on the UnmanagedCallersOnly attributes the managed registrar emits, so the NativeAOT compiler (ILC) can drop a trampoline's native export when the associated type (the NSObject subclass declaring the exported method) can't be constructed. Fixes https://github.com/dotnet/macios/issues/25631 --- tests/linker/link all/LinkAllTest.cs | 2 -- .../Steps/ManagedRegistrarStep.cs | 27 +++++++++++++++++-- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/tests/linker/link all/LinkAllTest.cs b/tests/linker/link all/LinkAllTest.cs index 1452076fd360..e70abcec6855 100644 --- a/tests/linker/link all/LinkAllTest.cs +++ b/tests/linker/link all/LinkAllTest.cs @@ -515,8 +515,6 @@ public void LinkedAwayGenericTypeAsOptionalMemberInProtocol () Assert.Ignore ("This test only applies when the dynamic registrar has been removed."); // https://github.com/dotnet/macios/issues/3523 - // TEMP-IGNORE-25915: temporarily ignored on net11.0 until https://github.com/dotnet/macios/pull/25915 is merged. - Assert.Ignore ("Temporarily ignored on net11.0: the trimmable static registrar's TypeMap path preserves the full exported method surface of registered types (e.g. UIResponder.PressesBegan takes an NSSet), which keeps NSSet alive. Fixed by https://github.com/dotnet/macios/pull/25915."); // Don't use constants here, because the linker can see what we're trying to do and keeps the type we're verifying has been removed. string prefix = NamespacePrefix; string suffix = AssemblyName; diff --git a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs index 76c6be5055c9..973d73a5645a 100644 --- a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs +++ b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs @@ -465,7 +465,7 @@ bool CreateUnmanagedCallersMethod (MethodDefinition method, AssemblyTrampolineIn } var callback = callbackType.AddMethod (name, MethodAttributes.Public | MethodAttributes.Static | MethodAttributes.HideBySig, placeholderType); - callback.CustomAttributes.Add (CreateUnmanagedCallersAttribute (name)); + callback.CustomAttributes.Add (CreateUnmanagedCallersAttribute (name, method.DeclaringType)); infos.Add (new TrampolineInfo (callback, method, name)); // If the target method is marked, then we must mark the trampoline as well. @@ -1532,11 +1532,34 @@ StaticRegistrar StaticRegistrar { get { return DerivedLinkContext.StaticRegistrar; } } - CustomAttribute CreateUnmanagedCallersAttribute (string entryPoint) + CustomAttribute CreateUnmanagedCallersAttribute (string entryPoint, TypeReference? associatedSourceType = null) { var unmanagedCallersAttribute = new CustomAttribute (abr.UnmanagedCallersOnlyAttribute_Constructor); + + // The AssociatedSourceType field tells the NativeAOT compiler (ILC) that the trampoline's + // native export is only needed if the associated type is kept. This only works safely when + // all of these are true: + // * We're compiling for NativeAOT (only ILC understands the field; the CoreCLR runtime's + // attribute parser even rejects any UnmanagedCallersOnly named argument it doesn't know). + // * We're using the trimmable static registrar, whose native glue references the trampoline + // symbols directly. This means ILC may drop the native export for a trampoline whose + // associated type can't be constructed, while the generated native registrar code still + // references it - which would result in an undefined symbol at native link time. + // * We're preparing assemblies (PrepareAssemblies), which is the mode that has a post-ILC + // step (the _PostprocessAssembliesAfterIlc target) that regenerates the native registrar + // code after ILC, routing any trampoline that didn't survive ILC through the dlsym fallback + // instead of a direct native reference. Without that reconciliation step (i.e. in the + // non-prepare mode) we must not let ILC drop any trampoline export, so we don't emit the + // field there. + if (associatedSourceType is not null + && App.XamarinRuntime == XamarinRuntime.NativeAOT + && App.Registrar == RegistrarMode.TrimmableStatic + && App.PrepareAssemblies) + unmanagedCallersAttribute.Fields.Add (new CustomAttributeNamedArgument ("AssociatedSourceType", new CustomAttributeArgument (abr.System_Type, associatedSourceType))); + if (App.XamarinRuntime != XamarinRuntime.CoreCLR) unmanagedCallersAttribute.Fields.Add (new CustomAttributeNamedArgument ("EntryPoint", new CustomAttributeArgument (abr.System_String, entryPoint))); + return unmanagedCallersAttribute; } From fe8ea7f3930b4686ac2b5709d9796ac876229df0 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 5 Aug 2026 19:00:10 +0200 Subject: [PATCH 12/23] [tests] Update expected sizes. --- .../expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt | 4 ++-- .../dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt | 4 ++-- .../expected/MacOSX-NativeAOT-TrimmableStatic-size.txt | 4 ++-- tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt | 4 ++-- .../expected/TVOS-NativeAOT-TrimmableStatic-size.txt | 4 ++-- tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt | 4 ++-- .../UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt | 4 ++-- tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt index aaa5bcf6096f..b91671512ca8 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 7,964,293 bytes (7,777.6 KB = 7.6 MB) +AppBundleSize: 2,267,013 bytes (2,213.9 KB = 2.2 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: 1,069 bytes (1.0 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 7,961,320 bytes (7,774.7 KB = 7.6 MB) + 2,264,040 bytes (2,211.0 KB = 2.2 MB) Contents/MonoBundle/runtimeconfig.bin: 1,896 bytes (1.9 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt index aaa5bcf6096f..b91671512ca8 100644 --- a/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/MacCatalyst-NativeAOT-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 7,964,293 bytes (7,777.6 KB = 7.6 MB) +AppBundleSize: 2,267,013 bytes (2,213.9 KB = 2.2 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: 1,069 bytes (1.0 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 7,961,320 bytes (7,774.7 KB = 7.6 MB) + 2,264,040 bytes (2,211.0 KB = 2.2 MB) Contents/MonoBundle/runtimeconfig.bin: 1,896 bytes (1.9 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt index d5dae8cbfbfe..44881de1b527 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-TrimmableStatic-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 17,120,691 bytes (16,719.4 KB = 16.3 MB) +AppBundleSize: 4,700,499 bytes (4,590.3 KB = 4.5 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: 747 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 17,118,088 bytes (16,716.9 KB = 16.3 MB) + 4,697,896 bytes (4,587.8 KB = 4.5 MB) Contents/MonoBundle/runtimeconfig.bin: 1,848 bytes (1.8 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt index d5dae8cbfbfe..44881de1b527 100644 --- a/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/MacOSX-NativeAOT-size.txt @@ -1,9 +1,9 @@ -AppBundleSize: 17,120,691 bytes (16,719.4 KB = 16.3 MB) +AppBundleSize: 4,700,499 bytes (4,590.3 KB = 4.5 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Contents/Info.plist: 747 bytes (0.7 KB = 0.0 MB) Contents/MacOS/SizeTestApp: - 17,118,088 bytes (16,716.9 KB = 16.3 MB) + 4,697,896 bytes (4,587.8 KB = 4.5 MB) Contents/MonoBundle/runtimeconfig.bin: 1,848 bytes (1.8 KB = 0.0 MB) Contents/PkgInfo: diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt index ebd8d392bd3e..0e910a3e56c7 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 7,095,392 bytes (6,929.1 KB = 6.8 MB) +AppBundleSize: 2,217,416 bytes (2,165.4 KB = 2.1 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: 1,135 bytes (1.1 KB = 0.0 MB) @@ -7,4 +7,4 @@ PkgInfo: runtimeconfig.bin: 1,889 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 7,092,360 bytes (6,926.1 KB = 6.8 MB) + 2,214,384 bytes (2,162.5 KB = 2.1 MB) diff --git a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt index ebd8d392bd3e..0e910a3e56c7 100644 --- a/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/TVOS-NativeAOT-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 7,095,392 bytes (6,929.1 KB = 6.8 MB) +AppBundleSize: 2,217,416 bytes (2,165.4 KB = 2.1 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: 1,135 bytes (1.1 KB = 0.0 MB) @@ -7,4 +7,4 @@ PkgInfo: runtimeconfig.bin: 1,889 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 7,092,360 bytes (6,926.1 KB = 6.8 MB) + 2,214,384 bytes (2,162.5 KB = 2.1 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt index 17b9e545222b..2c7644031db7 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-TrimmableStatic-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 8,219,303 bytes (8,026.7 KB = 7.8 MB) +AppBundleSize: 2,272,023 bytes (2,218.8 KB = 2.2 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: 1,159 bytes (1.1 KB = 0.0 MB) @@ -7,4 +7,4 @@ PkgInfo: runtimeconfig.bin: 1,888 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 8,216,248 bytes (8,023.7 KB = 7.8 MB) + 2,268,968 bytes (2,215.8 KB = 2.2 MB) diff --git a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt index 17b9e545222b..2c7644031db7 100644 --- a/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt +++ b/tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt @@ -1,4 +1,4 @@ -AppBundleSize: 8,219,303 bytes (8,026.7 KB = 7.8 MB) +AppBundleSize: 2,272,023 bytes (2,218.8 KB = 2.2 MB) # The following list of files and their sizes is just informational / for review, and isn't used in the test: Info.plist: 1,159 bytes (1.1 KB = 0.0 MB) @@ -7,4 +7,4 @@ PkgInfo: runtimeconfig.bin: 1,888 bytes (1.8 KB = 0.0 MB) SizeTestApp: - 8,216,248 bytes (8,023.7 KB = 7.8 MB) + 2,268,968 bytes (2,215.8 KB = 2.2 MB) From 747470c93b9eac3e643f6555ab2292607aa37f6d Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 5 Aug 2026 22:47:31 +0200 Subject: [PATCH 13/23] [tools] Report warnings as warnings in ErrorHelper.ShowInternal. 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> --- tools/common/ErrorHelper.tools.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/common/ErrorHelper.tools.cs b/tools/common/ErrorHelper.tools.cs index ae8c8ce88c02..1afab00b6a41 100644 --- a/tools/common/ErrorHelper.tools.cs +++ b/tools/common/ErrorHelper.tools.cs @@ -321,7 +321,13 @@ static bool ShowInternal (IToolLog log, Exception e) if (!error && GetWarningLevel (log, mte.Code) == WarningLevel.Disable) return false; // This is an ignored warning. - log.LogError (mte.ToString ()); + // Report warnings as warnings, otherwise they'd end up failing the build when + // the log is an MSBuild task (which is the case for the assembly preparer). + if (error) { + log.LogError (mte); + } else { + log.LogWarning (mte); + } ShowInner (log, e); From d556da5e28cfbb4e7488c3f57d989be56d01a92b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 5 Aug 2026 23:49:05 +0200 Subject: [PATCH 14/23] [nativeaot] Fix building apps with the trimmable static registrar. Building monotouch-test for macOS with TEST_VARIATION=nativeaot failed with two distinct errors, both fixed here. 1. ILC failed with: error : One or more errors occurred. (Failed to load type 'MonoTouchFixtures.ObjCRuntime.TrampolineTestGenerated+OverrideRegistrarTest' from assembly '_monotouchtest.TypeMap') The trampolines are emitted into the companion `_.TypeMap` assembly, while the `AssociatedSourceType` we point at lives in the user assembly. Cecil only writes an assembly-qualified type name when the type's scope differs from the module being written - and a `TypeDefinition`'s scope is its own module, so the name ended up unqualified and ILC resolved it against the companion assembly. Fixed by importing the type reference into the current module (the same gotcha is already documented in `AppBundleRewriter.CreateDynamicDependencyAttribute`). 2. The native linker then failed with: Undefined symbols: "_OBJC_CLASS_$_DerivedTestProtocolRegister", referenced from: inlined-class-gethandle.o When regenerating the registrar code after ILC, we skip classes whose trampolines were all trimmed away. However, the inlined `Class.GetHandle` optimization emits native code with a direct reference to the Objective-C class, so such a class must still be registered. Fixed by collecting the inlined `Class.GetHandle` symbols that ILC left unresolved and keeping the corresponding classes in the registrar. Note that the first issue masked the second one: ILC's export discovery decodes the whole `UnmanagedCallersOnlyAttribute`, and the invalid type name made that decoding throw, which silently dropped every trampoline export. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/code/class-handles.md | 7 +++++++ .../Tasks/PrepareAssemblies.cs | 6 ++++++ tools/common/Application.cs | 17 +++++++++++++++++ tools/common/StaticRegistrar.cs | 4 +++- .../dotnet-linker/Steps/ManagedRegistrarStep.cs | 11 +++++++++-- 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/docs/code/class-handles.md b/docs/code/class-handles.md index 998267728cd9..2c46c0799921 100644 --- a/docs/code/class-handles.md +++ b/docs/code/class-handles.md @@ -67,3 +67,10 @@ So we do the following: 3. The `_PostTrimmingProcessing` MSBuild target takes the surviving symbols from either path, generates the corresponding native Objective-C code, and adds it to the list of files to compile and link into the final executable. + +Note that the generated native code contains a direct reference to each surviving +Objective-C class, so the native registrar must register any such class, even when +ILC trimmed away all the trampolines for the corresponding managed type (otherwise +the reference would turn into a hard link error). This is why the surviving class +names are also passed to the registrar when the native registrar code is generated +after ILC (see `Application.ClassesReferencedByInlinedClassGetHandle`). diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareAssemblies.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareAssemblies.cs index 7a3867578538..cc371665d79a 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareAssemblies.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/PrepareAssemblies.cs @@ -91,6 +91,12 @@ public override bool Execute () survivingSymbols.Add (name); } preparer.Configuration.Application.SurvivingTrampolineSymbols = survivingSymbols; + + // A class whose trampolines were all trimmed away by ILC must still be registered if + // managed code that survived ILC looks up its class handle, because the generated + // inlined Class.GetHandle native code references the Objective-C class. + var referencedClasses = new HashSet (CollectPostILTrimInformation.FilterToClassSymbols (Xamarin.StaticLibrary.GetUnresolvedSymbols (NativeAOTObjectFile))); + preparer.Configuration.Application.ClassesReferencedByInlinedClassGetHandle = referencedClasses; } rv = preparer.PostProcess (out exceptions); } else { diff --git a/tools/common/Application.cs b/tools/common/Application.cs index 1f12836e02d1..82c0fa48fecc 100644 --- a/tools/common/Application.cs +++ b/tools/common/Application.cs @@ -102,6 +102,23 @@ public bool DidTrampolineSurviveIlc (string ucoEntryPoint) return SurvivingTrampolineSymbols.Contains (ucoEntryPoint); } + // The set of Objective-C class names whose inlined Class.GetHandle native function is still + // referenced by the NativeAOT compiler's (ILC) output. These classes must be registered in the + // native registrar code even if all their trampolines were trimmed away, because managed code + // still looks up their class handle (and the generated native code references the Objective-C + // class, which wouldn't exist otherwise). This is set alongside SurvivingTrampolineSymbols. + // See docs/code/class-handles.md. + public HashSet? ClassesReferencedByInlinedClassGetHandle; + + // Returns true if managed code that survived ILC looks up the class handle for the given + // Objective-C class name using the inlined Class.GetHandle optimization. + public bool IsClassReferencedByInlinedClassGetHandle (string exportedName) + { + if (ClassesReferencedByInlinedClassGetHandle is null) + return false; + return ClassesReferencedByInlinedClassGetHandle.Contains (exportedName); + } + #if ASSEMBLY_PREPARER public bool InCustomTrimmerStep = false; public bool IsPostProcessingAssemblies; diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index 7d25573bb23c..c9c409d57b02 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -2873,7 +2873,9 @@ void Specialize (AutoIndentStringBuilder sb, out string initialization_method) // A class is skipped only if it had trampolines and none survived ILC. Every other class is // emitted, so we must keep its entire base class chain (their @implementation is needed as // superclasses), even if a base class itself had all its trampolines trimmed away. - if (!hadTrampolines || survived) { + // A class whose class handle is still looked up from managed code that survived ILC must + // also be kept, even if all its trampolines were trimmed away. + if (!hadTrampolines || survived || App.IsClassReferencedByInlinedClassGetHandle (type.ExportedName)) { var keep = type; while (keep is not null && classesToKeep.Add (keep)) keep = keep.SuperType; diff --git a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs index 6f01d4bff176..498f37b546da 100644 --- a/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs +++ b/tools/dotnet-linker/Steps/ManagedRegistrarStep.cs @@ -1557,8 +1557,15 @@ CustomAttribute CreateUnmanagedCallersAttribute (string entryPoint, TypeReferenc if (associatedSourceType is not null && App.XamarinRuntime == XamarinRuntime.NativeAOT && App.Registrar == RegistrarMode.TrimmableStatic - && App.PrepareAssemblies) - unmanagedCallersAttribute.Fields.Add (new CustomAttributeNamedArgument ("AssociatedSourceType", new CustomAttributeArgument (abr.System_Type, associatedSourceType))); + && App.PrepareAssemblies) { + // Import the type into the current assembly, otherwise Cecil will serialize the Type argument + // without an assembly-qualified name when 'associatedSourceType' is a TypeDefinition from another + // assembly (because a TypeDefinition's Scope is its own module), and ILC won't be able to resolve + // it (the trampolines are emitted into the companion assembly, while the associated type is in the + // user assembly). + var importedSourceType = abr.CurrentAssembly.MainModule.ImportReference (associatedSourceType); + unmanagedCallersAttribute.Fields.Add (new CustomAttributeNamedArgument ("AssociatedSourceType", new CustomAttributeArgument (abr.System_Type, importedSourceType))); + } if (App.XamarinRuntime != XamarinRuntime.CoreCLR) unmanagedCallersAttribute.Fields.Add (new CustomAttributeNamedArgument ("EntryPoint", new CustomAttributeArgument (abr.System_String, entryPoint))); From 5a9d3d7599aafbfa18ebe1990e0c8b4dcbe954af Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 6 Aug 2026 00:25:12 +0200 Subject: [PATCH 15/23] [tests] Fix monotouch-test failures in the NativeAOT variation on macOS. Five tests failed when running monotouch-test for macOS with TEST_VARIATION=nativeaot. They all assert build-time behavior that no longer applies in the NativeAOT + PrepareAssemblies flow on .NET 11+, where ILLink isn't executed at all (ILC does all the trimming, see '_SkipILLink' in Xamarin.Shared.Sdk.targets), and where monotouch-test tells ILC to keep complete reflection metadata (NUnit requires $(IlcGenerateCompleteTypeMetadata)=true and $(IlcTrimMetadata)=false). * ProtocolTest.OnlyProtocol / ProtocolWithBaseType / ProtocolWithBaseTypeAndModel: the [Protocol] attributes are removed by a custom trimmer step (RemoveAttributesStep), which doesn't run when ILLink is skipped, so the attributes are still there. Added TestRuntime.IsILLinkSkipped and use it to expect the attributes. * RegistrarTest.RegistrarRemoval: ILC trims all the dynamic registrar's code, but keeps the reflection metadata for its types (complete type metadata promotes any type referenced from a kept member, and ObjCRuntime.Runtime has a static field of type DynamicRegistrar). So looking for the types says nothing about the removal; verify that Runtime.DynamicRegistrationSupported is false instead. * StrongEnumTest.GetConstant: reflection finds smart enum conversion methods ILC didn't generate any code for (the metadata is kept, the code isn't), and invoking those throws NotSupportedException. Skip such methods. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/bindings-test/ProtocolTest.cs | 5 ++++ tests/common/TestRuntime.LinkAll.cs | 14 ++++++++++ .../ObjCRuntime/RegistrarTest.cs | 11 ++++++++ .../ObjCRuntime/StrongEnumTests.cs | 26 +++++++++++++++++-- 4 files changed, 54 insertions(+), 2 deletions(-) diff --git a/tests/bindings-test/ProtocolTest.cs b/tests/bindings-test/ProtocolTest.cs index 4dd907155adc..f4086a6113ed 100644 --- a/tests/bindings-test/ProtocolTest.cs +++ b/tests/bindings-test/ProtocolTest.cs @@ -9,6 +9,11 @@ namespace Xamarin.BindingTests { public class ProtocolTest { bool HasProtocolAttributes { get { + // The [Protocol] attributes are removed by a custom trimmer step (RemoveAttributesStep), + // which doesn't run at all when ILLink is skipped, so the attributes are still around. + if (TestRuntime.IsILLinkSkipped) + return true; + if (TestRuntime.IsLinkAll) { #if OPTIMIZEALL var registeredProtocols = true; diff --git a/tests/common/TestRuntime.LinkAll.cs b/tests/common/TestRuntime.LinkAll.cs index 7b4fefc0a178..e5b322ffd5f7 100644 --- a/tests/common/TestRuntime.LinkAll.cs +++ b/tests/common/TestRuntime.LinkAll.cs @@ -44,6 +44,20 @@ public static bool IsLinkAny { } } + // When using NativeAOT on .NET 11+, ILLink isn't executed at all (ILC does all the trimming, see + // '_SkipILLink' in Xamarin.Shared.Sdk.targets), which means none of the custom trimmer steps that + // modify assemblies are applied to the app. In particular the attributes we'd otherwise remove + // (such as [Protocol]) are still there at runtime. + public static bool IsILLinkSkipped { + get { +#if NATIVEAOT && NET11_0_OR_GREATER + return true; +#else + return false; +#endif + } + } + // Returns "" at runtime, but the linker can't constant-fold this, which prevents // its dataflow analysis from resolving type names passed to Assembly.GetType. [MethodImpl (MethodImplOptions.NoInlining)] diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs index e2c46c5ce4ab..6d9c13344212 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs @@ -137,6 +137,16 @@ public void DoIt (_LongNSRange a, out _LongNSRange b, ref _LongNSRange c) [UnconditionalSuppressMessage ("Trimming", "IL2026", Justification = "This test verifies linker behavior, and as such any behavioral difference when the trimmer is enabled is exactly what it's looking for.")] public void RegistrarRemoval () { +#if NATIVEAOT && NET11_0_OR_GREATER + // ILLink isn't executed when using NativeAOT on .NET 11+ (ILC does all the trimming), and even + // though ILC trims away all the dynamic registrar's code, it still keeps the reflection metadata + // for its types: monotouch-test sets $(IlcGenerateCompleteTypeMetadata)=true (NUnit requires it), + // which promotes any type referenced from a member that's kept (ObjCRuntime.Runtime has a static + // field of type Registrar.DynamicRegistrar) to complete type metadata. So looking for the types + // says nothing about whether the dynamic registrar was removed; verify that dynamic registration + // has been turned off instead. + Assert.That (Runtime.DynamicRegistrationSupported, Is.False, "Dynamic registration support"); +#else // define set by xharness when creating test variations. // It's not safe to remove the dynamic registrar in monotouch-test (by design; some of the tested API makes it unsafe, and the linker correctly detects this), // so the dynamic registrar will only be removed if manually requested. @@ -148,6 +158,7 @@ public void RegistrarRemoval () #endif Assert.That (typeof (NSObject).Assembly.GetType ("Registrar.Registrar" + WorkAroundLinkerHeuristics) is null, Is.EqualTo (shouldBeRemoved), "Registrar removal"); Assert.That (typeof (NSObject).Assembly.GetType ("Registrar.DynamicRegistrar" + WorkAroundLinkerHeuristics) is null, Is.EqualTo (shouldBeRemoved), "DynamicRegistrar removal"); +#endif } #if !MONOMAC diff --git a/tests/monotouch-test/ObjCRuntime/StrongEnumTests.cs b/tests/monotouch-test/ObjCRuntime/StrongEnumTests.cs index 1c6cfe4d205f..e528749ff016 100644 --- a/tests/monotouch-test/ObjCRuntime/StrongEnumTests.cs +++ b/tests/monotouch-test/ObjCRuntime/StrongEnumTests.cs @@ -34,13 +34,15 @@ public void GetConstant () continue; foreach (var enumValue in Enum.GetValuesAsUnderlyingType (type)) { - var obj = getConstant.Invoke (null, new object [] { enumValue }); + if (!TryInvoke (getConstant, enumValue, out var obj)) + break; if (valuesToSkip.Remove ((type, enumValue))) continue; if (obj is not null) { - var rtrip = getValue.Invoke (null, new object [] { obj }); + if (!TryInvoke (getValue, obj, out var rtrip)) + break; Assert.That (rtrip, Is.EqualTo (Enum.ToObject (type, enumValue)), $"{type.FullName}.{enumValue}: Round trip failed: {enumValue}.GetConstant () -> {obj} but GetValue ({obj}) -> {rtrip}"); } } @@ -52,6 +54,26 @@ public void GetConstant () }); } + // Invokes a static method with a single argument. Returns false if there's no code for the method. + static bool TryInvoke (MethodInfo method, object argument, out object? result) + { +#if NATIVEAOT + // ILC doesn't generate code for methods that aren't used, but monotouch-test keeps the metadata + // for every method ($(IlcTrimMetadata)=false, which NUnit requires), so reflection can find + // methods that can't be invoked. There's nothing to verify for those, so skip them. + try { + result = method.Invoke (null, new object [] { argument }); + return true; + } catch (NotSupportedException) { + result = null; + return false; + } +#else + result = method.Invoke (null, new object [] { argument }); + return true; +#endif + } + (Type EnumType, object UnderlyingValue) [] GetSkippedEnumValues () { var rv = new List<(Type EnumType, object UnderlyingValue)> () { From 185ba62a027cb155f3d738f3004f16f19270abd3 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 6 Aug 2026 09:39:57 +0200 Subject: [PATCH 16/23] [tests] Update known test warnings. --- tests/dotnet/UnitTests/ProjectTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index f067c92bde11..d6c8fa3d768d 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -2807,10 +2807,11 @@ public void PublishAotMonoTouchTest_NoIL2009 (ApplePlatform platform, string run var warnings = BinLog.GetBuildLogWarnings (rv.BinLogPath) .FilterWarnings (platform); var expectedWarnings = new ExpectedBuildMessage [] { - new ExpectedBuildMessage ($"ILLINK", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.ConnectMethod (System.Reflection.MethodInfo, ObjCRuntime.Selector)'."), - new ExpectedBuildMessage ($"ILLINK", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.ConnectMethod (System.Type, System.Reflection.MethodInfo, Foundation.ExportAttribute)'."), - new ExpectedBuildMessage ($"ILLINK", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.ConnectMethod (System.Type, System.Reflection.MethodInfo, ObjCRuntime.Selector)'."), - new ExpectedBuildMessage ($"ILLINK", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.RegisterAssembly (System.Reflection.Assembly)'."), + new ExpectedBuildMessage ($"ILC", $"MonoTouchFixtures.ObjCRuntime.ClassTest.GetHandle(): Using member 'System.Type.MakeArrayType()' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available."), + new ExpectedBuildMessage ($"MSBuild", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.ConnectMethod (System.Reflection.MethodInfo, ObjCRuntime.Selector)'."), + new ExpectedBuildMessage ($"MSBuild", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.ConnectMethod (System.Type, System.Reflection.MethodInfo, Foundation.ExportAttribute)'."), + new ExpectedBuildMessage ($"MSBuild", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.ConnectMethod (System.Type, System.Reflection.MethodInfo, ObjCRuntime.Selector)'."), + new ExpectedBuildMessage ($"MSBuild", $"It's not safe to remove the dynamic registrar, because monotouchtest references 'ObjCRuntime.Runtime.RegisterAssembly (System.Reflection.Assembly)'."), new ExpectedBuildMessage ($"tests/bindings-test/RegistrarBindingTest.cs", $"Unable to locate the block to delegate conversion method for the method System.Void Xamarin.BindingTests.RegistrarBindingTest/FakePropertyBlock::set_MyOptionalProperty(Bindings.Test.SimpleCallback)'s parameter #1."), new ExpectedBuildMessage ($"tests/bindings-test/RegistrarBindingTest.cs", $"Unable to locate the block to delegate conversion method for the method System.Void Xamarin.BindingTests.RegistrarBindingTest/FakePropertyBlock::set_MyOptionalStaticProperty(Bindings.Test.SimpleCallback)'s parameter #1."), new ExpectedBuildMessage ($"tests/bindings-test/RegistrarBindingTest.cs", $"Unable to locate the block to delegate conversion method for the method System.Void Xamarin.BindingTests.RegistrarBindingTest/FakePropertyBlock::set_MyRequiredProperty(Bindings.Test.SimpleCallback)'s parameter #1."), @@ -2820,7 +2821,6 @@ public void PublishAotMonoTouchTest_NoIL2009 (ApplePlatform platform, string run new ExpectedBuildMessage ($"tests/bindings-test/RegistrarBindingTest.cs", $"Unable to locate the delegate to block conversion type for the return value of the method Bindings.Test.SimpleCallback Xamarin.BindingTests.RegistrarBindingTest/FakePropertyBlock::get_MyRequiredProperty()."), new ExpectedBuildMessage ($"tests/bindings-test/RegistrarBindingTest.cs", $"Unable to locate the delegate to block conversion type for the return value of the method Bindings.Test.SimpleCallback Xamarin.BindingTests.RegistrarBindingTest/FakePropertyBlock::get_MyRequiredStaticProperty()."), new ExpectedBuildMessage ($"tests/monotouch-test/dotnet/{platform.AsString ()}/obj/{config}/{Configuration.DotNetTfm}-{platform.AsString ().ToLower ()}{runtimeIdentifierInfix}linked/nunit.framework.dll", $"Assembly 'nunit.framework' produced AOT analysis warnings."), - new ExpectedBuildMessage ($"tests/monotouch-test/ObjCRuntime/ClassTest.cs", $"MonoTouchFixtures.ObjCRuntime.ClassTest.GetHandle(): Using member 'System.Type.MakeArrayType()' which has 'RequiresDynamicCodeAttribute' can break functionality when AOT compiling. The code for an array of the specified type might not be available."), new ExpectedBuildMessage ($"tests/monotouch-test/ObjCRuntime/RegistrarTest.cs", $"Unable to locate the block to delegate conversion method for the method System.Void MonoTouchFixtures.ObjCRuntime.GHIssue7733::DoWork(System.String,MonoTouchFixtures.ObjCRuntime.ACompletionHandler)'s parameter #2."), new ExpectedBuildMessage ($"tests/monotouch-test/ObjCRuntime/RegistrarTest.cs", $"Unable to locate the block to delegate conversion method for the method System.Void MonoTouchFixtures.ObjCRuntime.RegistrarTest/ClosedGenericParameter::Foo(System.Action`1)'s parameter #1."), new ExpectedBuildMessage ($"tests/monotouch-test/ObjCRuntime/RegistrarTest.cs", $"Unable to locate the block to delegate conversion method for the method System.Void MonoTouchFixtures.ObjCRuntime.RegistrarTest/RegistrarTestClass::TestNSAction(System.Action)'s parameter #1."), From 4fd25b37b83b798a90655454c350314cbe1d7908 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 6 Aug 2026 10:29:53 +0200 Subject: [PATCH 17/23] [tests] Fix RegistrarTest.ProtocolsTrimmedAway in the NativeAOT variation. The test failed when running monotouch-test for Mac Catalyst with TEST_VARIATION=nativeaot: it expects all the members of IUIApplicationDelegate to have been trimmed away, but they're still there. When using NativeAOT on .NET 11+, ILLink isn't executed at all (ILC does all the trimming, see '_SkipILLink' in Xamarin.Shared.Sdk.targets), and monotouch-test tells ILC to keep complete reflection metadata (NUnit requires $(IlcGenerateCompleteTypeMetadata)=true and $(IlcTrimMetadata)=false). This means that even though ILC trims away the code, the reflection metadata for the members is still there, so don't expect the members to be gone in that configuration. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- tests/monotouch-test/ObjCRuntime/RegistrarTest.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs index 6d9c13344212..466f4f0ddd33 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs @@ -5562,7 +5562,13 @@ public void ProtocolsTrimmedAway () void AssertMemberCount (Type type) { var members = type.GetMembers (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance); -#if OPTIMIZEALL || NATIVEAOT +#if NATIVEAOT && NET11_0_OR_GREATER + // ILLink isn't executed when using NativeAOT on .NET 11+ (ILC does all the trimming), and + // monotouch-test tells ILC to keep complete reflection metadata (NUnit requires + // $(IlcGenerateCompleteTypeMetadata)=true and $(IlcTrimMetadata)=false), so even though ILC + // trims away the code, the reflection metadata for the members is still there. + var expectNoMembers = false; +#elif OPTIMIZEALL || NATIVEAOT var expectNoMembers = true; #elif !__MACOS__ var expectNoMembers = global::XamarinTests.ObjCRuntime.Registrar.IsStaticRegistrar && TestRuntime.IsLinkAny; From 63687e0822f0c1cdc4839858a8409128d487758e Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 6 Aug 2026 13:08:46 +0200 Subject: [PATCH 18/23] [dotnet] Write the custom linker options file locally when building remotely from Windows. The custom linker options file is written by a `WriteLinesToFile` task that's passed a `SessionId`, which means that when building remotely from Windows the file is only written on the Mac. That was fine as long as the only consumer was ILLink (which runs on the Mac), but the `PrepareAssemblies` task isn't remoted (it doesn't need a Mac), so it looks for the file on the local machine, and fails: Xamarin.Shared.targets(3703): error: Unexpected exception 'PrepareAssemblies': Could not find file 'obj\Release\net11.0-ios\ios-arm64\custom-linker-options.txt'. This shows up in `DotNetProjectTest.PublishAotOnWindows`, because on .NET 11+ with NativeAOT + PrepareAssemblies, ILLink is skipped entirely, leaving `PrepareAssemblies` as the only consumer of the file. So write the file locally as well in that case. The contents are identical either way, since all the properties are evaluated locally in both cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b169a463-6209-484f-9a6a-cb4a0e13b000 --- dotnet/targets/Xamarin.Shared.Sdk.targets | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index b6815ed5c001..a288bb07c763 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -1060,6 +1060,18 @@ File="$(_CustomLinkerOptionsFile)" Lines="$(_CustomLinkerOptions)" Overwrite="true" /> + + +