From 868a31ac0129f4bcf376e6841eb276495a9830e5 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 28 May 2026 17:41:31 +0200 Subject: [PATCH 1/5] [tools] Simplify the creation of the list of frameworks a bit. We don't need to know whether we're building for a simulator or device when creating the list of frameworks, because now it's possible to specify different values for simulator vs device. This makes it possible to simplify the code a little bit. Most of this is indentation changes, so it's easier to review if hiding whitespace changes. --- tools/common/Driver.cs | 3 +- tools/common/Frameworks.cs | 554 +++++++++++++++++++------------------ 2 files changed, 279 insertions(+), 278 deletions(-) diff --git a/tools/common/Driver.cs b/tools/common/Driver.cs index c04f81cd0221..6e5eb225f38c 100644 --- a/tools/common/Driver.cs +++ b/tools/common/Driver.cs @@ -688,8 +688,7 @@ public static string CorlibName { public static Frameworks GetFrameworks (Application app) { - var rv = Frameworks.GetFrameworks (app.Platform, app.IsSimulatorBuild); - if (rv is null) + if (!Frameworks.TryGetFrameworks (app.Platform, out var rv)) throw ErrorHelper.CreateError (71, Errors.MX0071, app.Platform, app.ProductName); return rv; } diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index 3970120f17fa..a6c0c2207340 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -326,197 +326,194 @@ public static Frameworks MacFrameworks { } static Frameworks? ios_frameworks; - public static Frameworks GetiOSFrameworks (bool is_simulator_build) - { - if (ios_frameworks is null) - ios_frameworks = CreateiOSFrameworks (is_simulator_build); - return ios_frameworks; - } + public static Frameworks iOSFrameworks { + get { + if (ios_frameworks is null) { + ios_frameworks = new Frameworks () { + { "AddressBook", "AddressBook", 3 }, + { "Security", "Security", 3 }, + { "AudioUnit", "AudioToolbox", 3 }, + { "AddressBookUI", "AddressBookUI", 3 }, + { "AudioToolbox", "AudioToolbox", 3 }, + { "AVFoundation", "AVFoundation", 3 }, + { "CFNetwork", "CFNetwork", 3 }, + { "CoreAnimation", "QuartzCore", 3 }, + { "CoreAudio", "CoreAudio", 3 }, + { "CoreData", "CoreData", 3 }, + { "CoreFoundation", "CoreFoundation", 3 }, + { "CoreGraphics", "CoreGraphics", 3 }, + { "CoreLocation", "CoreLocation", 3 }, + { "ExternalAccessory", "ExternalAccessory", 3 }, + { "Foundation", "Foundation", 3 }, + { "GameKit", "GameKit", 3 }, + { "MapKit", "MapKit", 3 }, + { "MediaPlayer", "MediaPlayer", 3 }, + { "MessageUI", "MessageUI", 3 }, + { "MobileCoreServices", "MobileCoreServices", 3 }, + { "StoreKit", "StoreKit", 3 }, + { "SystemConfiguration", "SystemConfiguration", 3 }, + { "OpenGLES", "OpenGLES", 3 }, + { "UIKit", "UIKit", 3 }, + + { "Accelerate", "Accelerate", 4 }, + { "AssetsLibrary", "AssetsLibrary", new Version (4, 0), null, false, null, /* version_unavailable = */ new Version (17, 4) }, + { "EventKit", "EventKit", 4 }, + { "EventKitUI", "EventKitUI", 4 }, + { "CoreMotion", "CoreMotion", 4 }, + { "CoreMedia", "CoreMedia", 4 }, + { "CoreVideo", "CoreVideo", 4 }, + { "CoreTelephony", "CoreTelephony", 4 }, + { "QuickLook", "QuickLook", 4 }, + { "ImageIO", "ImageIO", 4 }, + { "CoreText", "CoreText", 4 }, + { "CoreMidi", "CoreMIDI", 4 }, + + { "Accounts", "Accounts", 5 }, + { "GLKit", "GLKit", 5 }, + { "NewsstandKit", "NewsstandKit", new Version (5, 0), null, false, null, /* version_unavailable = */ new Version (17, 0) }, + { "CoreImage", "CoreImage", 5 }, + { "CoreBluetooth", "CoreBluetooth", 5 }, + { "Twitter", "Twitter", 5 }, + { "GSS", "GSS", 5 }, + + { "MediaToolbox", "MediaToolbox", 6 }, + { "PassKit", "PassKit", 6 }, + { "Social", "Social", 6 }, + { "AdSupport", "AdSupport", 6 }, + + { "GameController", "GameController", 7 }, + { "JavaScriptCore", "JavaScriptCore", 7 }, + { "MediaAccessibility", "MediaAccessibility", 7 }, + { "MultipeerConnectivity", "MultipeerConnectivity", 7 }, + { "SafariServices", "SafariServices", 7 }, + { "SpriteKit", "SpriteKit", 7 }, + + { "HealthKit", "HealthKit", 8 }, + { "HomeKit", "HomeKit", 8 }, + { "LocalAuthentication", "LocalAuthentication", 8 }, + { "NotificationCenter", "NotificationCenter", 8 }, + { "PushKit", "PushKit", 8 }, + { "Photos", "Photos", 8 }, + { "PhotosUI", "PhotosUI", 8 }, + { "SceneKit", "SceneKit", 8 }, + { "CloudKit", "CloudKit", 8 }, + { "AVKit", "AVKit", 8 }, + { "CoreAudioKit", "CoreAudioKit", new Version (8, 0), new Version (9, 0) }, + { "Metal", "Metal", new Version (8, 0), new Version (9, 0) }, + { "WebKit", "WebKit", 8 }, + { "NetworkExtension", "NetworkExtension", 8 }, + { "VideoToolbox", "VideoToolbox", 8 }, + + { "ReplayKit", "ReplayKit", 9 }, + { "Contacts", "Contacts", 9 }, + { "ContactsUI", "ContactsUI", 9 }, + { "CoreSpotlight", "CoreSpotlight", 9 }, + { "WatchConnectivity", "WatchConnectivity", 9 }, + { "ModelIO", "ModelIO", 9 }, + { "MetalKit", "MetalKit", 9 }, + { "MetalPerformanceShaders", "MetalPerformanceShaders", new Version (9, 0), new Version (11, 0) /* MPS got simulator headers in Xcode 9 */ }, + { "GameplayKit", "GameplayKit", 9 }, + { "HealthKitUI", "HealthKitUI", 9, 3 }, - public static Frameworks CreateiOSFrameworks (bool is_simulator_build) - { - return new Frameworks () { - { "AddressBook", "AddressBook", 3 }, - { "Security", "Security", 3 }, - { "AudioUnit", "AudioToolbox", 3 }, - { "AddressBookUI", "AddressBookUI", 3 }, - { "AudioToolbox", "AudioToolbox", 3 }, - { "AVFoundation", "AVFoundation", 3 }, - { "CFNetwork", "CFNetwork", 3 }, - { "CoreAnimation", "QuartzCore", 3 }, - { "CoreAudio", "CoreAudio", 3 }, - { "CoreData", "CoreData", 3 }, - { "CoreFoundation", "CoreFoundation", 3 }, - { "CoreGraphics", "CoreGraphics", 3 }, - { "CoreLocation", "CoreLocation", 3 }, - { "ExternalAccessory", "ExternalAccessory", 3 }, - { "Foundation", "Foundation", 3 }, - { "GameKit", "GameKit", 3 }, - { "MapKit", "MapKit", 3 }, - { "MediaPlayer", "MediaPlayer", 3 }, - { "MessageUI", "MessageUI", 3 }, - { "MobileCoreServices", "MobileCoreServices", 3 }, - { "StoreKit", "StoreKit", 3 }, - { "SystemConfiguration", "SystemConfiguration", 3 }, - { "OpenGLES", "OpenGLES", 3 }, - { "UIKit", "UIKit", 3 }, - - { "Accelerate", "Accelerate", 4 }, - { "AssetsLibrary", "AssetsLibrary", new Version (4, 0), null, false, null, /* version_unavailable = */ new Version (17, 4) }, - { "EventKit", "EventKit", 4 }, - { "EventKitUI", "EventKitUI", 4 }, - { "CoreMotion", "CoreMotion", 4 }, - { "CoreMedia", "CoreMedia", 4 }, - { "CoreVideo", "CoreVideo", 4 }, - { "CoreTelephony", "CoreTelephony", 4 }, - { "QuickLook", "QuickLook", 4 }, - { "ImageIO", "ImageIO", 4 }, - { "CoreText", "CoreText", 4 }, - { "CoreMidi", "CoreMIDI", 4 }, - - { "Accounts", "Accounts", 5 }, - { "GLKit", "GLKit", 5 }, - { "NewsstandKit", "NewsstandKit", new Version (5, 0), null, false, null, /* version_unavailable = */ new Version (17, 0) }, - { "CoreImage", "CoreImage", 5 }, - { "CoreBluetooth", "CoreBluetooth", 5 }, - { "Twitter", "Twitter", 5 }, - { "GSS", "GSS", 5 }, - - { "MediaToolbox", "MediaToolbox", 6 }, - { "PassKit", "PassKit", 6 }, - { "Social", "Social", 6 }, - { "AdSupport", "AdSupport", 6 }, - - { "GameController", "GameController", 7 }, - { "JavaScriptCore", "JavaScriptCore", 7 }, - { "MediaAccessibility", "MediaAccessibility", 7 }, - { "MultipeerConnectivity", "MultipeerConnectivity", 7 }, - { "SafariServices", "SafariServices", 7 }, - { "SpriteKit", "SpriteKit", 7 }, - - { "HealthKit", "HealthKit", 8 }, - { "HomeKit", "HomeKit", 8 }, - { "LocalAuthentication", "LocalAuthentication", 8 }, - { "NotificationCenter", "NotificationCenter", 8 }, - { "PushKit", "PushKit", 8 }, - { "Photos", "Photos", 8 }, - { "PhotosUI", "PhotosUI", 8 }, - { "SceneKit", "SceneKit", 8 }, - { "CloudKit", "CloudKit", 8 }, - { "AVKit", "AVKit", 8 }, - { "CoreAudioKit", "CoreAudioKit", is_simulator_build ? 9 : 8 }, - { "Metal", "Metal", new Version (8, 0), new Version (9, 0) }, - { "WebKit", "WebKit", 8 }, - { "NetworkExtension", "NetworkExtension", 8 }, - { "VideoToolbox", "VideoToolbox", 8 }, - - { "ReplayKit", "ReplayKit", 9 }, - { "Contacts", "Contacts", 9 }, - { "ContactsUI", "ContactsUI", 9 }, - { "CoreSpotlight", "CoreSpotlight", 9 }, - { "WatchConnectivity", "WatchConnectivity", 9 }, - { "ModelIO", "ModelIO", 9 }, - { "MetalKit", "MetalKit", 9 }, - { "MetalPerformanceShaders", "MetalPerformanceShaders", new Version (9, 0), new Version (11, 0) /* MPS got simulator headers in Xcode 9 */ }, - { "GameplayKit", "GameplayKit", 9 }, - { "HealthKitUI", "HealthKitUI", 9,3 }, - - { "CallKit", "CallKit", 10 }, - { "Messages", "Messages", 10 }, - { "Speech", "Speech", 10 }, - { "VideoSubscriberAccount", "VideoSubscriberAccount", 10 }, - { "UserNotifications", "UserNotifications", 10 }, - { "UserNotificationsUI", "UserNotificationsUI", 10 }, - { "Intents", "Intents", 10 }, - { "IntentsUI", "IntentsUI", 10 }, - - { "ARKit", "ARKit", 11 }, - { "CoreNFC", "CoreNFC", new Version (11, 0), new Version (15, 0), true }, /* not always present, e.g. iPad w/iOS 12, so must be weak linked; doesn't work in the simulator in Xcode 12 (https://stackoverflow.com/q/63915728/183422), but works in at least Xcode 15 (maybe earlier too) */ - { "DeviceCheck", "DeviceCheck", new Version (11, 0), new Version (13, 0) }, - { "IdentityLookup", "IdentityLookup", 11 }, - { "IOSurface", "IOSurface", new Version (11, 0), new Version (26, 0) /* The headers were broken at some point, not sure when they started working again */ }, - { "CoreML", "CoreML", 11 }, - { "Vision", "Vision", 11 }, - { "FileProvider", "FileProvider", 11 }, - { "FileProviderUI", "FileProviderUI", 11 }, - { "PdfKit", "PDFKit", 11 }, - - { "BusinessChat", "BusinessChat", 11, 3 }, - - { "ClassKit", "ClassKit", 11,4 }, - - { "AuthenticationServices", "AuthenticationServices", 12,0 }, - { "CarPlay", "CarPlay", 12,0 }, - { "CoreServices", "MobileCoreServices", 12, 0 }, - { "IdentityLookupUI", "IdentityLookupUI", 12,0 }, - { "NaturalLanguage", "NaturalLanguage", 12,0 }, - { "Network", "Network", 12, 0 }, - - { "BackgroundTasks", "BackgroundTasks", 13, 0 }, - { "CoreHaptics", "CoreHaptics", 13, 0 }, - { "CryptoTokenKit", "CryptoTokenKit", 13, 0 }, - { "LinkPresentation", "LinkPresentation", 13, 0 }, - { "MetricKit", "MetricKit", 13, 0 }, - { "PencilKit", "PencilKit", 13, 0 }, - { "QuickLookThumbnailing", "QuickLookThumbnailing", 13,0 }, - { "SoundAnalysis", "SoundAnalysis", 13, 0 }, - { "VisionKit", "VisionKit", 13, 0 }, - - { "AutomaticAssessmentConfiguration", "AutomaticAssessmentConfiguration", 13, 4 }, - - { "Accessibility", "Accessibility", 14,0 }, - { "AppClip", "AppClip", 14,0 }, - { "AppTrackingTransparency", "AppTrackingTransparency", 14,0 }, - { "MediaSetup", "MediaSetup", new Version (14, 0), NotAvailableInSimulator /* no headers in beta 3 */ }, - { "MetalPerformanceShadersGraph", "MetalPerformanceShadersGraph", 14,0 }, - { "MLCompute", "MLCompute", new Version (14,0), NotAvailableInSimulator }, - { "NearbyInteraction", "NearbyInteraction", 14,0 }, - { "ScreenTime", "ScreenTime", 14,0 }, - { "SensorKit", "SensorKit", new Version (14, 0), null, true }, /* not always present on device, e.g. any iPad, so must be weak linked; https://github.com/dotnet/macios/issues/9938 */ - { "UniformTypeIdentifiers", "UniformTypeIdentifiers", 14,0 }, - - { "AdServices", "AdServices", 14,3 }, - - { "CoreLocationUI", "CoreLocationUI", 15,0 }, - - { "DataDetection", "DataDetection", 15, 0 }, - { "Phase", "PHASE", new Version (15, 0), new Version (26, 0) /* not certain about the exact version when this framework was added to the simulator, but this should be a safe default */ }, - { "OSLog", "OSLog", 15,0 }, - { "ShazamKit", "ShazamKit", new Version (15,0), new Version (16, 0)}, - { "ThreadNetwork", "ThreadNetwork", new Version (15,0), NotAvailableInSimulator}, - - - { "AVRouting", "AVRouting", 16,0}, - { "BackgroundAssets", "BackgroundAssets", 16,0}, - { "DeviceDiscoveryExtension", "DeviceDiscoveryExtension", 16, 0}, - { "MetalFX", "MetalFX", new Version (16,0), NotAvailableInSimulator }, - { "PushToTalk", "PushToTalk", new Version (16,0), new Version (16, 2) /* available to build with, although it's unusable */}, - { "SafetyKit", "SafetyKit", 16, 0 }, - { "SharedWithYou", "SharedWithYou", 16, 0 }, - { "SharedWithYouCore", "SharedWithYouCore", 16, 0 }, - - { "Cinematic", "Cinematic", new Version (17, 0), NotAvailableInSimulator }, - { "Symbols", "Symbols", 17, 0 }, - { "SensitiveContentAnalysis", "SensitiveContentAnalysis", 17, 0 }, - { "BrowserEngineCore", "BrowserEngineCore", 17, 4}, - { "BrowserEngineKit", "BrowserEngineKit", 17, 4}, - - { "AccessorySetupKit", "AccessorySetupKit", 18, 0 }, - - { "SecurityUI", "SecurityUI", 18, 4 }, - - { "DeviceDiscoveryUI", "DeviceDiscoveryUI", 26, 0 }, - { "ExtensionKit", "ExtensionKit", 26, 0 }, - { "GameSave", "GameSave", 26, 0 }, - { "TouchController", "TouchController", 26, 0 }, - // the above MUST be kept in sync with simlauncher - // see tools/mtouch/Makefile - // please also keep it sorted to ease comparison - // - // The following tests also need to be updated: - // - // * RegistrarTest.MT4134 - }; + { "CallKit", "CallKit", 10 }, + { "Messages", "Messages", 10 }, + { "Speech", "Speech", 10 }, + { "VideoSubscriberAccount", "VideoSubscriberAccount", 10 }, + { "UserNotifications", "UserNotifications", 10 }, + { "UserNotificationsUI", "UserNotificationsUI", 10 }, + { "Intents", "Intents", 10 }, + { "IntentsUI", "IntentsUI", 10 }, + + { "ARKit", "ARKit", 11 }, + { "CoreNFC", "CoreNFC", new Version (11, 0), new Version (15, 0), true }, /* not always present, e.g. iPad w/iOS 12, so must be weak linked; doesn't work in the simulator in Xcode 12 (https://stackoverflow.com/q/63915728/183422), but works in at least Xcode 15 (maybe earlier too) */ + { "DeviceCheck", "DeviceCheck", new Version (11, 0), new Version (13, 0) }, + { "IdentityLookup", "IdentityLookup", 11 }, + { "IOSurface", "IOSurface", new Version (11, 0), new Version (26, 0) /* The headers were broken at some point, not sure when they started working again */ }, + { "CoreML", "CoreML", 11 }, + { "Vision", "Vision", 11 }, + { "FileProvider", "FileProvider", 11 }, + { "FileProviderUI", "FileProviderUI", 11 }, + { "PdfKit", "PDFKit", 11 }, + + { "BusinessChat", "BusinessChat", 11, 3 }, + + { "ClassKit", "ClassKit", 11, 4 }, + + { "AuthenticationServices", "AuthenticationServices", 12, 0 }, + { "CarPlay", "CarPlay", 12, 0 }, + { "CoreServices", "MobileCoreServices", 12, 0 }, + { "IdentityLookupUI", "IdentityLookupUI", 12, 0 }, + { "NaturalLanguage", "NaturalLanguage", 12, 0 }, + { "Network", "Network", 12, 0 }, + + { "BackgroundTasks", "BackgroundTasks", 13, 0 }, + { "CoreHaptics", "CoreHaptics", 13, 0 }, + { "CryptoTokenKit", "CryptoTokenKit", 13, 0 }, + { "LinkPresentation", "LinkPresentation", 13, 0 }, + { "MetricKit", "MetricKit", 13, 0 }, + { "PencilKit", "PencilKit", 13, 0 }, + { "QuickLookThumbnailing", "QuickLookThumbnailing", 13, 0 }, + { "SoundAnalysis", "SoundAnalysis", 13, 0 }, + { "VisionKit", "VisionKit", 13, 0 }, + + { "AutomaticAssessmentConfiguration", "AutomaticAssessmentConfiguration", 13, 4 }, + + { "Accessibility", "Accessibility", 14, 0 }, + { "AppClip", "AppClip", 14, 0 }, + { "AppTrackingTransparency", "AppTrackingTransparency", 14, 0 }, + { "MediaSetup", "MediaSetup", new Version (14, 0), NotAvailableInSimulator /* no headers in beta 3 */ }, + { "MetalPerformanceShadersGraph", "MetalPerformanceShadersGraph", 14, 0 }, + { "MLCompute", "MLCompute", new Version (14, 0), NotAvailableInSimulator }, + { "NearbyInteraction", "NearbyInteraction", 14, 0 }, + { "ScreenTime", "ScreenTime", 14, 0 }, + { "SensorKit", "SensorKit", new Version (14, 0), null, true }, /* not always present on device, e.g. any iPad, so must be weak linked; https://github.com/dotnet/macios/issues/9938 */ + { "UniformTypeIdentifiers", "UniformTypeIdentifiers", 14, 0 }, + + { "AdServices", "AdServices", 14, 3 }, + + { "CoreLocationUI", "CoreLocationUI", 15, 0 }, + + { "DataDetection", "DataDetection", 15, 0 }, + { "Phase", "PHASE", new Version (15, 0), new Version (26, 0) /* not certain about the exact version when this framework was added to the simulator, but this should be a safe default */ }, + { "OSLog", "OSLog", 15, 0 }, + { "ShazamKit", "ShazamKit", new Version (15, 0), new Version (16, 0) }, + { "ThreadNetwork", "ThreadNetwork", new Version (15, 0), NotAvailableInSimulator }, + + + { "AVRouting", "AVRouting", 16, 0 }, + { "BackgroundAssets", "BackgroundAssets", 16, 0 }, + { "DeviceDiscoveryExtension", "DeviceDiscoveryExtension", 16, 0 }, + { "MetalFX", "MetalFX", new Version (16, 0), NotAvailableInSimulator }, + { "PushToTalk", "PushToTalk", new Version (16, 0), new Version (16, 2) /* available to build with, although it's unusable */}, + { "SafetyKit", "SafetyKit", 16, 0 }, + { "SharedWithYou", "SharedWithYou", 16, 0 }, + { "SharedWithYouCore", "SharedWithYouCore", 16, 0 }, + + { "Cinematic", "Cinematic", new Version (17, 0), NotAvailableInSimulator }, + { "Symbols", "Symbols", 17, 0 }, + { "SensitiveContentAnalysis", "SensitiveContentAnalysis", 17, 0 }, + { "BrowserEngineCore", "BrowserEngineCore", 17, 4 }, + { "BrowserEngineKit", "BrowserEngineKit", 17, 4 }, + + { "AccessorySetupKit", "AccessorySetupKit", 18, 0 }, + + { "SecurityUI", "SecurityUI", 18, 4 }, + + { "DeviceDiscoveryUI", "DeviceDiscoveryUI", 26, 0 }, + { "ExtensionKit", "ExtensionKit", 26, 0 }, + { "GameSave", "GameSave", 26, 0 }, + { "TouchController", "TouchController", 26, 0 }, + // the above MUST be kept in sync with simlauncher + // see tools/mtouch/Makefile + // please also keep it sorted to ease comparison + // + // The following tests also need to be updated: + // + // * RegistrarTest.MT4134 + }; + } + return ios_frameworks; + } } static Frameworks? tvos_frameworks; @@ -633,100 +630,105 @@ public static Frameworks TVOSFrameworks { } static Frameworks? catalyst_frameworks; - public static Frameworks GetMacCatalystFrameworks () - { - if (catalyst_frameworks is null) { - catalyst_frameworks = CreateiOSFrameworks (false); - // not present in iOS but present in catalyst - catalyst_frameworks.Add ("CoreWlan", "CoreWLAN", 15, 0); - - var min = new Version (13, 0); - var v14_0 = new Version (14, 0); - var v14_2 = new Version (14, 2); - var v16_1 = new Version (16, 1); - var v18_0 = new Version (18, 0); - var v26_0 = new Version (26, 0); - var v16_0 = new Version (16, 0); - foreach (var f in catalyst_frameworks.Values) { - switch (f.Name) { - // These frameworks were added to Catalyst after they were added to iOS, so we have to adjust the Versions fields - case "CoreTelephony": - case "HomeKit": - case "Messages": - f.Version = v14_0; - f.VersionAvailableInSimulator = v14_0; - break; - case "AddressBook": - case "ClassKit": - case "UserNotificationsUI": - f.Version = v14_2; - f.VersionAvailableInSimulator = v14_2; - break; - case "ThreadNetwork": - f.Version = v16_1; - break; - case "Cinematic": - f.Version = v26_0; - break; - case "MediaSetup": - f.Version = v16_0; - break; - case "BrowserEngineKit": - case "DeviceDiscoveryExtension": - f.Version = v18_0; - break; - // These frameworks are not available on Mac Catalyst - case "DeviceDiscoveryUI": // xtro and introspection says it's not in Mac Catalyst, Apple's website says it is. For now, listen to xtro and introspection, until proven otherwise. - case "OpenGLES": - case "NotificationCenter": - case "GLKit": - case "VideoSubscriberAccount": - case "AccessorySetupKit": - // The headers for FileProviderUI exist, but the native linker fails - case "FileProviderUI": - // The headers for Twitter are there, , but no documentation whatsoever online and the native linker fails too - case "Twitter": - // headers-based xtro reporting those are *all* unknown API for Catalyst - case "AddressBookUI": - case "ARKit": - case "BrowserEngineCore": - case "CarPlay": - case "WatchConnectivity": - f.Unavailable = true; - break; - // and nothing existed before Catalyst 13.0 - default: - if (f.Version < min) - f.Version = min; - if (f.VersionAvailableInSimulator < min) - f.VersionAvailableInSimulator = min; - break; + public static Frameworks MacCatalystFrameworks { + get { + if (catalyst_frameworks is null) { + catalyst_frameworks = iOSFrameworks; + // not present in iOS but present in catalyst + catalyst_frameworks.Add ("CoreWlan", "CoreWLAN", 15, 0); + + var min = new Version (13, 0); + var v14_0 = new Version (14, 0); + var v14_2 = new Version (14, 2); + var v16_1 = new Version (16, 1); + var v18_0 = new Version (18, 0); + var v26_0 = new Version (26, 0); + var v16_0 = new Version (16, 0); + foreach (var f in catalyst_frameworks.Values) { + switch (f.Name) { + // These frameworks were added to Catalyst after they were added to iOS, so we have to adjust the Versions fields + case "CoreTelephony": + case "HomeKit": + case "Messages": + f.Version = v14_0; + f.VersionAvailableInSimulator = v14_0; + break; + case "AddressBook": + case "ClassKit": + case "UserNotificationsUI": + f.Version = v14_2; + f.VersionAvailableInSimulator = v14_2; + break; + case "ThreadNetwork": + f.Version = v16_1; + break; + case "Cinematic": + f.Version = v26_0; + break; + case "MediaSetup": + f.Version = v16_0; + break; + case "BrowserEngineKit": + case "DeviceDiscoveryExtension": + f.Version = v18_0; + break; + // These frameworks are not available on Mac Catalyst + case "DeviceDiscoveryUI": // xtro and introspection says it's not in Mac Catalyst, Apple's website says it is. For now, listen to xtro and introspection, until proven otherwise. + case "OpenGLES": + case "NotificationCenter": + case "GLKit": + case "VideoSubscriberAccount": + case "AccessorySetupKit": + // The headers for FileProviderUI exist, but the native linker fails + case "FileProviderUI": + // The headers for Twitter are there, , but no documentation whatsoever online and the native linker fails too + case "Twitter": + // headers-based xtro reporting those are *all* unknown API for Catalyst + case "AddressBookUI": + case "ARKit": + case "BrowserEngineCore": + case "CarPlay": + case "WatchConnectivity": + f.Unavailable = true; + break; + // and nothing existed before Catalyst 13.0 + default: + if (f.Version < min) + f.Version = min; + if (f.VersionAvailableInSimulator < min) + f.VersionAvailableInSimulator = min; + break; + } } - } - // Add frameworks that are not in iOS - catalyst_frameworks.Add ("AppKit", 13, 0); - catalyst_frameworks.Add ("ExecutionPolicy", 16, 0); - catalyst_frameworks.Add ("ServiceManagement", 16, 0); - catalyst_frameworks.Add ("ScreenCaptureKit", 18, 2); + // Add frameworks that are not in iOS + catalyst_frameworks.Add ("AppKit", 13, 0); + catalyst_frameworks.Add ("ExecutionPolicy", 16, 0); + catalyst_frameworks.Add ("ServiceManagement", 16, 0); + catalyst_frameworks.Add ("ScreenCaptureKit", 18, 2); + } + return catalyst_frameworks; } - return catalyst_frameworks; } - // returns null if the platform doesn't exist (the ErrorHandler machinery is heavy and this file is included in several projects, which makes throwing an exception complicated) - public static Frameworks? GetFrameworks (ApplePlatform platform, bool is_simulator_build) + public static bool TryGetFrameworks (ApplePlatform platform, [NotNullWhen (true)] out Frameworks? frameworks) { switch (platform) { case ApplePlatform.iOS: - return GetiOSFrameworks (is_simulator_build); + frameworks = iOSFrameworks; + return true; case ApplePlatform.TVOS: - return TVOSFrameworks; + frameworks = TVOSFrameworks; + return true; case ApplePlatform.MacOSX: - return MacFrameworks; + frameworks = MacFrameworks; + return true; case ApplePlatform.MacCatalyst: - return GetMacCatalystFrameworks (); + frameworks = MacCatalystFrameworks; + return true; default: - return null; + frameworks = null; + return false; } } @@ -771,9 +773,9 @@ public static bool TryGetFramework (Application app, TypeDefinition? td, [NotNul if (!TryGetFramework (app, td, out string? frameworkName)) return false; - var all_frameworks = GetFrameworks (app.Platform, app.IsSimulatorBuild); - if (all_frameworks is null) + if (!TryGetFrameworks (app.Platform, out var all_frameworks)) return false; + return all_frameworks.TryGetValue (frameworkName, out framework); } @@ -810,9 +812,9 @@ static void Gather (Application app, IEnumerable assemblies, } // Iterate over all the namespaces and check which frameworks we need to link with. - var all_frameworks = GetFrameworks (app.Platform, app.IsSimulatorBuild); - if (all_frameworks is null) + if (!TryGetFrameworks (app.Platform, out var all_frameworks)) return; + foreach (var nspace in namespaces) { if (!all_frameworks.TryGetValue (nspace, out var framework)) continue; From 21019203d16bd05b34a0344a294f4bc8427e296f Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 2 Jun 2026 17:35:25 +0200 Subject: [PATCH 2/5] Fix build. --- .../generate-frameworks-constants.cs | 5 ++++- .../Validators/SmartEnumValidator.cs | 3 +-- tools/common/Frameworks.cs | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/generate-frameworks-constants/generate-frameworks-constants.cs b/scripts/generate-frameworks-constants/generate-frameworks-constants.cs index 979f62b473cb..001593364636 100644 --- a/scripts/generate-frameworks-constants/generate-frameworks-constants.cs +++ b/scripts/generate-frameworks-constants/generate-frameworks-constants.cs @@ -32,7 +32,10 @@ static ApplePlatform GetPlatform (string platform) static int Fix (ApplePlatform platform, string output) { - var frameworks = Frameworks.GetFrameworks (platform, false)!.Values.Where (v => !v.IsFrameworkUnavailable ()); + if (!Frameworks.TryGetFrameworks (platform, out var fwks)) + return 1; + + var frameworks = fwks.Values.Where (v => !v.IsFrameworkUnavailable ()); var sb = new StringBuilder (); sb.AppendLine ("namespace ObjCRuntime {"); diff --git a/src/rgen/Microsoft.Macios.Bindings.Analyzer/Validators/SmartEnumValidator.cs b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Validators/SmartEnumValidator.cs index 11f00d6c2c1e..be0058d0619a 100644 --- a/src/rgen/Microsoft.Macios.Bindings.Analyzer/Validators/SmartEnumValidator.cs +++ b/src/rgen/Microsoft.Macios.Bindings.Analyzer/Validators/SmartEnumValidator.cs @@ -134,8 +134,7 @@ internal static bool ValidateLibraryPathValue (Binding binding, RootContext cont return false; } - var appleFrameworks = Frameworks.GetFrameworks (platformName.ToApplePlatform (), false); - if (appleFrameworks is null) { + if (!Frameworks.TryGetFrameworks (platformName.ToApplePlatform (), out var appleFrameworks)) { // we could not get the frameworks, we have a bug // we could not identify the platform, we have a bug diagnostics = [Diagnostic.Create ( diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index a6c0c2207340..fa51856cf3f7 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; #if LEGACY_TOOLS || BUNDLER From f28f7d720fae2c35fbf250854e99c70beff3e405 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 2 Jun 2026 17:54:03 +0200 Subject: [PATCH 3/5] Avoid cache poisoning. --- tools/common/Frameworks.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/common/Frameworks.cs b/tools/common/Frameworks.cs index fa51856cf3f7..da24cd2bf347 100644 --- a/tools/common/Frameworks.cs +++ b/tools/common/Frameworks.cs @@ -635,6 +635,8 @@ public static Frameworks MacCatalystFrameworks { get { if (catalyst_frameworks is null) { catalyst_frameworks = iOSFrameworks; + // We're going to mutate the value returned from iOSFrameworks, so clear the cached value so the next time iOSFrameworks is called it's re-generated. + ios_frameworks = null; // not present in iOS but present in catalyst catalyst_frameworks.Add ("CoreWlan", "CoreWLAN", 15, 0); From 5306358e566c6b4ea6e49f43d88c46aae0513c9c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 3 Jun 2026 09:17:20 +0200 Subject: [PATCH 4/5] Fix introspection build. --- tests/introspection/ApiFrameworkTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/introspection/ApiFrameworkTest.cs b/tests/introspection/ApiFrameworkTest.cs index bfcd1af6c7ab..ea03f8e191e3 100644 --- a/tests/introspection/ApiFrameworkTest.cs +++ b/tests/introspection/ApiFrameworkTest.cs @@ -72,9 +72,9 @@ public bool Skip (string? @namespace) Frameworks GetFrameworks () { #if __MACCATALYST__ - return Frameworks.GetMacCatalystFrameworks (); + return Frameworks.MacCatalystFrameworks; #elif __IOS__ - return Frameworks.GetiOSFrameworks (app.IsSimulatorBuild); + return Frameworks.iOSFrameworks; #elif __TVOS__ return Frameworks.TVOSFrameworks; #elif __MACOS__ From ded861e642bea7e80738ab588a4dbc855af447b0 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 3 Jun 2026 09:20:12 +0200 Subject: [PATCH 5/5] Fix xtro --- tests/xtro-sharpie/xtro-sanity/Sanitizer.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/xtro-sharpie/xtro-sanity/Sanitizer.cs b/tests/xtro-sharpie/xtro-sanity/Sanitizer.cs index 2afdc4d6d6d4..67325b5274d4 100644 --- a/tests/xtro-sharpie/xtro-sanity/Sanitizer.cs +++ b/tests/xtro-sharpie/xtro-sanity/Sanitizer.cs @@ -357,7 +357,7 @@ static bool IsFrameworkIncludedInPlatform (string platform, string framework) return true; // If the framework is registered for the current platform, then it's included. - var frameworks = Frameworks.GetFrameworks (ApplePlatformExtensions.Parse (platform), false); + var frameworks = GetFrameworks (platform); if (frameworks?.Any (x => string.Equals (x.Key, framework, StringComparison.OrdinalIgnoreCase)) == true) return true; @@ -372,9 +372,16 @@ static List GetAllFrameworks () return all_frameworks; } + static Frameworks GetFrameworks (ApplePlatform platform) + { + if (!Frameworks.TryGetFrameworks (platform, out var frameworks)) + throw new Exception ($"No frameworks for {platform}?"); + return frameworks; + } + static Frameworks GetFrameworks (string platform) { - return Frameworks.GetFrameworks (ApplePlatformExtensions.Parse (platform), false)!; + return GetFrameworks (ApplePlatformExtensions.Parse (platform)); } static List GetFrameworks (IEnumerable platforms)