Граф коммитов

7369 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge ef077323f3
[bgen] Fix using arrays of INativeObjects in delegate signatures. (#21183) 2024-09-09 15:25:38 +02:00
Rolf Bjarne Kvinge d909174f47
[tests] Make the simulator the default runtime identifier when running test suites from the command line. (#21194)
Because simulator is where we most commonly run tests.

And hardcode arm64 - if x64 is ever needed, and I'm bugged enough to add
auto-detection, I'll do it then.
2024-09-09 15:03:14 +02:00
Rolf Bjarne Kvinge 941ead0ff4
[bgen] Fix using types that are in multiple namespaces. (#21182)
There's both a Network.NWEndpoint and a NetworkExtension.NWEndpoint, and the
generator generates ambiguous code in certain cases.

Fix the generator to use the full type reference for such types.
2024-09-09 14:28:15 +02:00
Rolf Bjarne Kvinge 7325ce8ca8
[bgen] Fix compiler warnings. (#21184)
And make warnings report as errors, so this doesn't happen again.
2024-09-09 12:25:03 +02:00
Rolf Bjarne Kvinge 02fe91bcb2
[xcode16] Merge main into xcode16. (#21164) 2024-09-07 01:41:12 +02:00
Rolf Bjarne Kvinge ea8310c33a
[Intents] Fix a few missing APIs for Xcode 16 beta 1-6. (#21138) 2024-09-06 14:58:04 +02:00
Rolf Bjarne Kvinge 92cd45d064
[MediaAccessibility] Implement Xcode 16.0 beta 4 changes. (#21144) 2024-09-06 13:55:19 +02:00
Rolf Bjarne Kvinge 83c0fedcd5
[bgen] Add support for more backing field types. (#21172) 2024-09-06 12:44:14 +02:00
Rolf Bjarne Kvinge 9efe6948a0
[AuthenticationServices] Implement Xcode 16.0 beta 1-6 changes. (#21143) 2024-09-06 12:08:17 +02:00
Rolf Bjarne Kvinge ae99651b5c Merge remote-tracking branch 'origin/xcode16' into dev/rolf/bump-main-in-xcode16-2024-09-02 2024-09-06 11:34:35 +02:00
Rolf Bjarne Kvinge 11c3903695 [xharness] Remove introspection for legacy Xamarin test suites.
There's a bug where the test variation to run introspection on older OS
versions doesn't properly exclude legacy Xamarin variations when legacy
Xamarin is disabled.

Since legacy Xamarin is dead, just remove introspection for legacy Xamarin
completely.
2024-09-06 11:29:55 +02:00
Rolf Bjarne Kvinge e3950ef9be Merge remote-tracking branch 'origin/main' into dev/rolf/bump-main-in-net9.0-2024-09-04 2024-09-05 19:36:32 +02:00
Rolf Bjarne Kvinge a6dca9db10 [monotouch-test] Adjust how we detect when protocols are registered. 2024-09-05 19:36:03 +02:00
Rolf Bjarne Kvinge 3f6da31049 [monotouch-test] Fix NativeAOT compilation + detecting when protocols are registered. 2024-09-05 14:19:03 +02:00
Rolf Bjarne Kvinge e2c0cb331a
[MapKit] Implement Xcode 16.0 beta 1-6 changes. (#20893)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-09-05 14:12:09 +02:00
Rolf Bjarne Kvinge afb561b9d6
[HealthKit] Implement Xcode 16.0 beta 1-6 changes. (#21146)
There were no changes in beta 2, beta 3, beta 4 or beta 6.
2024-09-05 14:06:24 +02:00
Rolf Bjarne Kvinge 22d6e44411
[CoreSpotlight] Implement Xcode 16.0 beta 1-6 changes. (#20866)
Note: there were no changes in beta 2-6.
2024-09-05 13:58:28 +02:00
Rolf Bjarne Kvinge e0782fa51f
[ContactProvider] Don't bind this framework. (#21160)
For all intents and purposes it's Swift only.
2024-09-05 13:01:38 +02:00
Rolf Bjarne Kvinge c206728177 Merge remote-tracking branch 'origin/main' into dev/rolf/bump-main-in-xcode16-2024-09-02 2024-09-05 12:24:17 +02:00
Rolf Bjarne Kvinge f61f129fe6
[CoreImage] Implement Xcode 16 beta 6 changes. (#21117)
Also some xtro cleanup.
2024-09-05 12:06:58 +02:00
Rolf Bjarne Kvinge 9edb31477d
[MetalPerforanceShadersGraph] Implement Xcode 16.0 beta 1-6 changes. (#21154)
Note: there were no changes in beta 2, beta 3, beta 5 or beta 6.
2024-09-05 12:06:09 +02:00
Rolf Bjarne Kvinge 7439accc6b
[Accessibility] Implement Xcode 16.0 beta 1-6 changes. (#21070)
Note: there were no changes in beta 3, beta 4, beta 5 or beta 6.
2024-09-05 09:41:48 +02:00
Rolf Bjarne Kvinge 7dd8f3ef7c
[CoreData] Implement Xcode 16.0 beta 1-6 changes. (#21113)
Note: there were no changes in beta 1, beta 2, beta 3, beta 5 or beta 6.
2024-09-05 09:40:50 +02:00
Rolf Bjarne Kvinge 3de8349a9d
[Security] Implement Xcode 16.0 beta 1-6 changes. (#21152)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-09-05 09:40:01 +02:00
Rolf Bjarne Kvinge f0d4a30a64
[Vision] Implement Xcode 16.0 beta 1-6 changes. (#21149)
Note: there were no changes in beta 2, beta 3 or beta 6.
2024-09-05 09:39:03 +02:00
Rolf Bjarne Kvinge 1f5e485c80
[StoreKit] Implement Xcode 16.0 beta 1-6 changes. (#21165)
No changes in beta 2, beta 3, beta 4, beta 5 or beta 6.

This is basically a giant deprecation in favor of StoreKit 2 (which is
Swift only).
2024-09-04 23:28:59 +02:00
Rolf Bjarne Kvinge b2a5fd4199
[Network] Fix binding mistake in NWConnection. (#21174)
The 'nw_connection_set_viability_changed_handler' P/Invoke was originally
bound as 'SetBooleanChangeHandler', which isn't quite right.

So now bind it as 'SetViabilityChangeHandler', obsolete the old version and
remove it in XAMCORE_5_0.
2024-09-04 23:14:07 +02:00
Rolf Bjarne Kvinge b7c593935a
[DeviceDiscoveryExtension] Implement Xcode 16 beta 6 changes. (#21175)
This is just adding the framework to macOS and Mac Catalyst.
2024-09-04 19:06:27 +02:00
Rolf Bjarne Kvinge a854ebe1b8
[tests] Improve test Makefile when specifying runtime identifier on the command line. (#21169)
Using RUNTIMEIDENTIFIER(S) in the Makefile interferes with the build, because
they get passed on to msbuild, which sees them as properties (RuntimeIdentifier(s)).

Thus use RID instead, and only pass on the value to the build if appropriate.
2024-09-04 18:16:19 +02:00
Rolf Bjarne Kvinge 47bd4d9f82
[PencilKit] Implement Xcode 16.0 beta 1-6 changes. (#21148)
Note: there were no changes in beta 4, beta 5 or beta 6.
2024-09-04 16:50:34 +02:00
Rolf Bjarne Kvinge e714ce4c7b
[LockedCameraCapture] Don't bind this framework. (#21161)
For all intents and purposes it's Swift only.
2024-09-04 16:49:43 +02:00
Rolf Bjarne Kvinge 16207e9898
[CarPlay] Implement Xcode 16.0 beta 1-6 changes. (#21039)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-09-04 16:48:08 +02:00
Rolf Bjarne Kvinge a6a11784d4 [net9.0] Merge main into net9.0. 2024-09-04 15:24:51 +02:00
Rolf Bjarne Kvinge 515d0ce8f7
[AccessorySetupKit] Implement Xcode 16.0 beta 1-6 changes. (#20857)
Note: there were no changes in beta 2 or beta 3.
2024-09-03 18:06:27 +02:00
Rolf Bjarne Kvinge 73683f8124 [xcode16] Merge main into xcode16. 2024-09-02 19:51:07 +02:00
Rolf Bjarne Kvinge 3b6a5c20c6
[bgen] Add support for delegates with pointer types. (#21159) 2024-09-02 15:02:39 +02:00
Rolf Bjarne Kvinge ff707c145e
[dotnet-linker] Trim away the static constructor for protocol interfaces if we're registering protocols in the static registrar. (#21012)
When we implemented support for using default interface members for binding protocols, we also unintentionally introduced a size regression. This happened because we now tell the linker to keep all methods in a protocol interface, thus all the corresponding types end up marked as well, etc.

This had an additional side effect: depending on the types that weren't linked away anymore, the App Store could flag an app, saying that additional entitlements is needed. This is what's happening in #21002: the App Store detects that the app references the `application:didRegisterForRemoteNotificationsWithDeviceToken:` selector [1] (from the method `RegisteredForRemoteNotifications` on `IUIApplicationDelegate`) and tells the developer they probably need the push notification entitlement.

The good news is that we don't need these protocol interface methods at runtime if the optimization to register protocols with the static registrar is enabled (which it is by default).

In this PR I teach the optimizer to remove the DynamicDependency attributes keeping these protocol interface methods from being trimmed out.

## Size improvements

* monotouch-test build for Release/ios-arm64 shrinks by [2.9mb (-2.6%)](https://gist.github.com/rolfbjarne/5e8ca6ea6854dc4a46f8e838dff11e6b)
* A very simple app (tests/dotnet/MySimpleApp) shrinks by [176kb (-0.3%)](https://gist.github.com/rolfbjarne/f0e062900528eb499fd96d124d18376f)

[1]: This is somewhat speculative, but it's probably not far from what the App Store actually does.

Fixes #21002.
2024-09-02 15:02:10 +02:00
Rolf Bjarne Kvinge a26a7fd231 [xcode16] Merge main into xcode16. 2024-08-31 02:49:11 +02:00
Rolf Bjarne Kvinge ad310053f8
[bgen] Generate Obsolete + EditorBrowsable attributes in a few more cases. (#21135)
* Forward [Obsolete] from api definition interfaces.
* Generate [EditorBrowsable] whenever an api definition member as either
  [EditorBrowsable] or [Obsolete].
2024-08-31 00:48:17 +02:00
Rolf Bjarne Kvinge 73c035a818
[CoreVideo] Create a strongly typed dictionary for the CVPixelFormat values. (#21110)
Also a few other misc API improvements.
2024-08-30 21:01:28 +02:00
Rolf Bjarne Kvinge 56de4fa92e
[ObjCRuntime/bgen] Add support for (s)byte, (u)short and nuint fields. (#21141) 2024-08-29 20:14:52 +02:00
Rolf Bjarne Kvinge b4070eb62f
[xcode16] Merge main into xcode16. (#21123) 2024-08-29 11:19:12 +02:00
Rolf Bjarne Kvinge 38b50768b9
[xcode16] Revert workarounds for breaking changes in earlier betas due to Apple removing watchOS APIs (#21121) 2024-08-29 00:10:35 +02:00
Rolf Bjarne Kvinge 6bdd5441d5
[ImageIO] Implement Xcode 16 beta 4-6 changes. (#21136)
Note: there were no changes in beta 5 or beta 6.
2024-08-28 20:51:00 +02:00
dotnet-maestro[bot] a58c044830
[main] Update dependencies from dotnet/installer (#21021)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer

- **Subscription**: 80cb9ffd-f92f-4fc8-9f8b-08dbca46abfb
- **Build**: 20240819.10
- **Date Produced**: August 19, 2024 9:04:53 PM UTC
- **Commit**: 6e9002c2efcfc09687feca31864ebc987c3c9ec8
- **Branch**: refs/heads/release/8.0.1xx

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 8.0.109-servicing.24416.1 to 8.0.109-servicing.24419.10][8]

[8]: 228439883b...6e9002c2ef

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 8.0.7 to 8.0.8 (parent: Microsoft.Dotnet.Sdk.Internal)
  - **Microsoft.AspNetCore.App.Ref**: from 8.0.7 to 8.0.8 (parent: Microsoft.Dotnet.Sdk.Internal)
  - **Microsoft.NETCore.App.Ref**: from 8.0.7 to 8.0.8 (parent: Microsoft.Dotnet.Sdk.Internal)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100**: from 8.0.7 to 8.0.8 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 8.0.7 to 8.0.8 (parent: Microsoft.Dotnet.Sdk.Internal)
2024-08-28 20:41:27 +02:00
Rolf Bjarne Kvinge e9a895aa1b
[ModelIO] Implement Xcode 16.0 beta 1-6 changes. (#21032)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-27 17:49:11 +02:00
Rolf Bjarne Kvinge 85f5678b46
[CoreMedia] Implement Xcode 16 beta 3-6 changes. (#21118)
Note: there were no changes in beta 4, beta 5 or beta 6.
2024-08-27 17:47:19 +02:00
Rolf Bjarne Kvinge 6f82340880 [xcode16] Merge main into xcode16. 2024-08-27 14:41:36 +02:00
Rolf Bjarne Kvinge da709f1ec9
[bgen] Add methods to convert between arrays of strong enum values and their underlying native enum type. (#21089)
This will be helpful for some new Xcode 16 APIs.
2024-08-27 14:41:01 +02:00
Rolf Bjarne Kvinge 84bcea0a40
[AudioToolbox] Implement Xcode 16.0 beta 1-6 changes. (#20856)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-27 13:58:15 +02:00
Rolf Bjarne Kvinge 54fd609c01
[CoreFoundation] Implement Xcode 16.0 beta 1-6 changes. (#21116)
Note: there we no changes in beta 1, beta 2, beta 3, beta 4 or beta 6.

Additionally, none of the added APIs are APIs we'll bind for now,
they're rather specialized.
2024-08-27 13:56:03 +02:00
Rolf Bjarne Kvinge 0aed4d8aaf
[Network] Implement Xcode 16.0 beta 1-6 changes. (#21075)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 22:36:50 +02:00
Rolf Bjarne Kvinge adc67f1ef1
[MessageUI] Implement Xcode 16.0 beta 1-6 changes. (#20892)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 22:27:07 +02:00
Rolf Bjarne Kvinge 2c443ca50f
[ScreenCaptureKit] Implement Xcode 16.0 beta 1-6 changes. (#21071)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 22:26:19 +02:00
Rolf Bjarne Kvinge 7399ff9b32
[PdfKit] Implement Xcode 16.0 beta 1-6 changes. (#21034)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 20:01:16 +02:00
Rolf Bjarne Kvinge 863c31f861
[CoreAudioTypes] Implement Xcode 16.0 beta 1-6 changes. (#21019)
The capitalization of these new enum members matches the capitalization
of other MPEG* enum members in the same enum.

Note: there were no changes in beta 2, beta 4, beta 5 or beta 6.
2024-08-26 20:00:28 +02:00
Rolf Bjarne Kvinge 0cd9749b78
[MetalFX] Implement Xcode 16.0 beta 1-6 changes. (#21020)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 19:59:01 +02:00
Rolf Bjarne Kvinge 6d6e5ec1c3
[PhotosUI] Implement Xcode 16.0 beta 1-6 changes. (#21041)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 19:58:33 +02:00
Rolf Bjarne Kvinge c40115f294
[FSKit] Implement this new framework. (#21029)
Marked as a preview API, because this framework requires implementing a
user-space file system to validate anything, and that's a bit too much
at the moment.

Tentatively marking this for stable release in .NET 11.

Up-to-date until beta 6.
2024-08-26 19:58:03 +02:00
Rolf Bjarne Kvinge 762e628bd8
[CoreGraphics] Implement Xcode 16.0 beta 1-6 changes. (#21033)
Note: there were no changes in beta 3, beta 5 or beta 6.
2024-08-26 19:56:23 +02:00
Rolf Bjarne Kvinge 06798764a4
[bgen] Improve nullability detection to detect the nullability attributes the C# compiler generates. Fixes #17130. (#21099)
Fixes https://github.com/xamarin/xamarin-macios/issues/17130.
2024-08-26 19:10:40 +02:00
Rolf Bjarne Kvinge 19b925e54a
[GameKit] Implement Xcode 16.0 beta 1-6 changes. (#20880)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 19:08:55 +02:00
Rolf Bjarne Kvinge 6302fe77eb
[xcode16] Merge main into xcode16. (#21112) 2024-08-26 18:40:44 +02:00
Rolf Bjarne Kvinge beac080a06
[AutomaticAssessmentConfiguration] Implement Xcode beta 5-6 changes. (#21028)
There were no changes in beta 4 or beta 6.
2024-08-26 17:07:05 +02:00
Rolf Bjarne Kvinge 90acc663f9
[VideoSubscriberAccount] Implement Xcode 16.0 beta 1-6 changes. (#21067)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-26 17:05:44 +02:00
Rolf Bjarne Kvinge 0f06df6bf3
[CoreText] Implement Xcode 16.0 beta 1-6 changes. (#20878)
Note: there were no changes in beta 2, beta 3, beta 4 or beta 6.
2024-08-26 16:49:05 +02:00
Rolf Bjarne Kvinge 46506898d4
Bump to Xcode 16 beta 6. (#21088) 2024-08-26 16:21:58 +02:00
Rolf Bjarne Kvinge f417c91828
[system-dependencies] We don't need autotools anymore, so don't check for it. (#21104)
Autotools was required to build mono from source, which we haven't done
in a *long* time.
2024-08-26 11:34:44 +02:00
Rolf Bjarne Kvinge cc395235af [xcode16] Merge main into xcode16. 2024-08-26 10:46:00 +02:00
Rolf Bjarne Kvinge 15e2c21cd8
[xcode16] Merge main into xcode16. (#21097) 2024-08-26 10:45:09 +02:00
Rolf Bjarne Kvinge f3a7879a28
[CloudKit] Implement Xcode 16.0 beta 1-6 changes. (#20861)
The bindings that have been removed haven't fully been removed from the
headers, but it looks like they will be soon. These bindings have also been
deprecated since before the earliest OS versions we support, so there should
be no need to keep them around.

Removing them preemptively also lessens the risk of running into App Store
rejections in the future.

A few tests changes were needed to ignore the newly obsoleted/hidden APIs.

Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-23 16:44:32 +02:00
Rolf Bjarne Kvinge 6016b2c49d
[UniformTypeIdentifiers] Implement Xcode 16.0 beta 1-6 changes. (#21068)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-23 16:32:53 +02:00
Rolf Bjarne Kvinge d5b76740a4
[HomeKit] Implement Xcode 16.0 beta 1-6 changes. (#21080)
Note: there were no changes in beta 2, beta 4 or beta 6.
2024-08-23 12:18:22 +02:00
Rolf Bjarne Kvinge a4f9a50ea7
[SpriteKit] Implement Xcode 16.0 beta 1-6 changes. (#21053)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-23 11:49:29 +02:00
Rolf Bjarne Kvinge 0f70086682
[bgen] Fix generating delegates with nullable return types. #17109. (#21094)
Fixes https://github.com/xamarin/xamarin-macios/issues/17109.
2024-08-23 11:48:10 +02:00
Rolf Bjarne Kvinge d5b59443f3
[Foundation] Implement Xcode 16.0 beta 1-6 changes. (#21065)
Note: there were no changes in beta 2, beta 4, beta 5 or beta 6.
2024-08-23 11:43:49 +02:00
Rolf Bjarne Kvinge c7003b6bd8
[LocalAuthentication] Implement Xcode 16.0 beta 1-6 changes. (#20891)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-23 11:38:28 +02:00
Rolf Bjarne Kvinge 34dfc2cfb3
[Speech] Implement Xcode 16.0 beta 1-6 changes. (#21077)
There were no changes in beta 2, beta 4, beta 5 or beta 6.
2024-08-22 17:15:52 +02:00
Rolf Bjarne Kvinge fa7e84d7bf
[UserNotifications] Implement Xcode 16.0 beta 1-6 changes. (#21066)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-22 15:47:59 +02:00
Rolf Bjarne Kvinge 633b7a21c5 [xcode16] Merge main into xcode16. 2024-08-22 14:20:29 +02:00
Rolf Bjarne Kvinge 510d87299d
[ShazamKit] Implement Xcode 16.0 beta 1-6 changes. (#21051)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-22 14:08:33 +02:00
Rolf Bjarne Kvinge 622ffc4147
[CoreMidi] Move fields to the api definition. (#21043) 2024-08-22 11:58:09 +02:00
Rolf Bjarne Kvinge 9e58a82ac7
[CoreAnimation] Implement Xcode 16.0 beta 1-6 changes. (#21050)
I also added some missing APIs from earlier Xcode versions.

There were no changes in beta 1, beta 3, beta 4, beta 5 or beta 6.
2024-08-22 11:35:41 +02:00
Rolf Bjarne Kvinge 942084e236
[Symbols] Implement Xcode 16.0 beta 1-6 changes. (#21056)
There were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-22 09:52:34 +02:00
Rolf Bjarne Kvinge ee7d65d99e
[QuickLook] Implement Xcode 16.0 beta 1-6 changes. (#21052)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-22 09:50:39 +02:00
Rolf Bjarne Kvinge ac516e8f38
[SceneKit] Implement Xcode 16.0 beta 1-6 changes. (#21055)
Note: there were changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-22 09:47:44 +02:00
Rolf Bjarne Kvinge 703efade7d
[MediaPlayer] Implement Xcode 16.0 beta 1-6 changes. (#21072)
Note: there were no changes in beta 2, beta 4, beta 5 or beta 6.
2024-08-22 09:39:45 +02:00
Rolf Bjarne Kvinge 47c7798ad7
[TVMLKit] Implement Xcode 16.0 beta 1-6 changes. (#21064)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-22 09:38:07 +02:00
Rolf Bjarne Kvinge e0a3240106
[QuickLookThumbnailing] Implement Xcode 16.0 beta 1-6 changes. (#21049)
Note: there were no changes in beta 2, beta 3, beta 4, beta 5 or beta 6.
2024-08-21 17:12:57 +02:00
Rolf Bjarne Kvinge 2fa8625416
[Photos] Implement Xcode 16.0 beta 1-6 changes. (#21040)
Note: there were no changes in beta 3, beta 4, beta 5 or beta 6.
2024-08-21 14:16:44 +02:00
Rolf Bjarne Kvinge dbcb10a525 [net9.0] Merge main into net9.0. 2024-08-21 12:26:22 +02:00
Rolf Bjarne Kvinge a64b3e33dc
[JavaScriptCore] Implement Xcode 16.0 beta 1-6 changes. (#20883)
Note: there were no changes in beta 2-6.

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2024-08-21 11:04:25 +02:00
Rolf Bjarne Kvinge bd51954783 Merge remote-tracking branch 'origin/main' into dev/rolf/bump-main-in-xcode16-2024-08-19 2024-08-19 17:32:42 +02:00
Rolf Bjarne Kvinge 57578e7773
[xtro] Improve auto-sanitize to automatically delete empty files. (#21045) 2024-08-19 15:25:25 +02:00
Rolf Bjarne Kvinge 4bea0584c8 [xcode16] Merge main into xcode16. 2024-08-19 14:23:49 +02:00
Peter Collins c5e8a3dc78
Backport maestro and artifact drop infra improvements from net9.0 (#21057)
Backports the following maestro and artifact storage changes,
removing dependencies on bosstoragemirror and adding support
for passwordless maestro auth.


0d1bd7b1bc

ebf969ee40

2562461eeb
2024-08-19 14:10:17 +02:00
Rolf Bjarne Kvinge 854ca9321c
[dotnet-linker] Fix computing block signatures. Fixes #21008. (#21011)
When we compute the signature of a block for Objective-C, we need to use
parameters of the user-provided callback (and not the intermediate
UnmanagedCallersOnly method) to compute the signature.

This is because the intermediate method's parameters don't have all the
information we need to correctly compute the block signature (in
particular for the issue in question, the user callback has an `NSError`
parameter, while the intermediate method has an `IntPtr` parameter, and
these two parameter types show up differently in the block signature).

This is solved by adding the `UserDelegateType` attribute (which was
created for exactly this, and it's just in older generated code) to the
intermediate method, pointing to a delegate with the correct managed
signature.

Fixes https://github.com/xamarin/xamarin-macios/issues/21008.
2024-08-15 10:02:55 +02:00
Rolf Bjarne Kvinge a3dd5dd402
[xtro] Fix a few problem when validating DllImports. (#21026)
* Handle DllImports without an EntryPoint value correctly.
* Keep track of DllImports we've found separately, instead of removing entries
  from the list of DllImports we found. This fixes an issue with native
  functions that are declared more than once in the headers: we'd match the
  first instance to the DllImport, and then report the second one as 'not
  bound'.
2024-08-15 10:02:01 +02:00
Rolf Bjarne Kvinge 8fad547c92
[bgen] Add support for specifying the backing field for strong enums using a new BackingFieldType attribute. (#21016) 2024-08-14 21:20:43 +02:00
Rolf Bjarne Kvinge d8a8c33612
[CoreGraphics] Bind the CGSession API. (#21024)
And use it to ignore a few tests that fail when the screen is locked.
2024-08-14 19:41:28 +02:00
Rolf Bjarne Kvinge 3127c2e6c1 [net9.0] Merge main into net9.0. 2024-08-14 17:58:49 +02:00
Rolf Bjarne Kvinge 80a70faab9 [xcode16] Merge main into xcode16. 2024-08-14 17:52:54 +02:00
Rolf Bjarne Kvinge 76b69ffa13
[bgen] Add support for NSNumber as the underlying type for Objective-C fields. (#21018) 2024-08-14 13:43:31 +02:00
Rolf Bjarne Kvinge 7da04184cf
[tests] Improve the CustomizedCodeSigning tests to not depend on file order. (#20889)
The CustomizedCodeSigning test asserts that a certain condition shows a
particular error message from codesign.

There are multiple files in the app bundle that can trigger this particular
message, so change the logic to not assert on a particular file, instead use
assert on the remained of the error message.

Fixes this random test failure:

    Xamarin.Tests.DotNetProjectTest.CustomizedCodeSigning(iOS,"ios-arm64"): Failure when comparing error messages:
        Unexpected error message #0:
            Expected: /usr/bin/codesign exited with code 1:\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Diagnostics.DiagnosticSource.dll
            Actual: /usr/bin/codesign exited with code 1:\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64
        Unexpected error message #1:
            Expected: Failed to codesign '/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app': /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Diagnostics.DiagnosticSource.dll
            Actual: Failed to codesign '/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app': /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature\n/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all\nIn subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64
        All errors:
            /usr/bin/codesign exited with code 1:
                /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature
                /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all
                In subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64
                        Failed to codesign '/Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app': /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: replacing existing signature
                /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app: code object is not signed at all
                In subcomponent: /Users/builder/azdo/_work/4/s/xamarin-macios/tests/dotnet/CustomizedCodeSigning/iOS/bin/Debug/net9.0-ios/ios-arm64/CustomizedCodeSigning.app/System.Collections.NonGeneric.aotdata.arm64

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2024-08-12 18:58:17 +02:00
dotnet-maestro[bot] 2142e3190c
[net9.0] Update dependencies from dotnet/sdk (#20994)
This pull request updates the following dependencies

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 9.0.0-rc.1.24406.14 to 9.0.0-rc.1.24408.12 (parent: Microsoft.NET.Sdk)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-rc.1.24406.14 to 9.0.0-rc.1.24408.12 (parent: Microsoft.NET.Sdk)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: from 9.0.0-rc.1.24379.5 to 9.0.0-rc.1.24402.2 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-rc.1.24406.14 to 9.0.0-rc.1.24408.12 (parent: Microsoft.NET.Sdk)

## From https://github.com/dotnet/sdk

- **Subscription**: 3727984b-7a79-4ba3-37dd-08dbe6bddf31
- **Build**: 20240809.1
- **Date Produced**: August 9, 2024 8:31:14 AM UTC
- **Commit**: 43360291a50c9c7c471551f8f8363919d38014ea
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.NET.Sdk**: [from 9.0.100-rc.1.24408.2 to 9.0.100-rc.1.24409.1][9]
  - **Microsoft.NET.ILLink.Tasks**: [from 9.0.0-rc.1.24406.14 to 9.0.0-rc.1.24408.12][10]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-rc.1.24406.14 to 9.0.0-rc.1.24408.12][10]
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: [from 9.0.0-rc.1.24379.5 to 9.0.0-rc.1.24402.2][11]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-rc.1.24406.14 to 9.0.0-rc.1.24408.12][10]

[9]: 196789faff...43360291a5
[10]: 4985021ebf...68511fd27f
[11]: bdc1e33d5d...edf3e90fa2
2024-08-12 11:22:46 +02:00
Rolf Bjarne Kvinge 1fca27f2bc [xtro] Fix Mac Catalyst stuff for Xcode 16 b5. 2024-08-09 19:05:12 +02:00
Rolf Bjarne Kvinge 5492bd1dd6 Merge remote-tracking branch 'origin/xcode16' into dev/rolf/bump-main-in-xcode16-2024-08-06 2024-08-09 18:27:41 +02:00
Manuel de la Pena c5383a19b1
[Xcode16] Bump Xcode to beta 5. (#20998)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2024-08-09 18:26:56 +02:00
Rolf Bjarne Kvinge 75be879708
[ObjCRuntime] Allow a null delegate in Runtime.ReleaseBlockWhenDelegateIsCollected. Fixes #20920. (#20999)
Allow a null delegate in Runtime.ReleaseBlockWhenDelegateIsCollected if the corresponding native pointer is also null.

Fixes https://github.com/xamarin/xamarin-macios/issues/20920.
2024-08-09 14:32:19 +02:00
Rolf Bjarne Kvinge fe71a5f38b [xtro] Fix Mac Catalyst stuff for Xcode 16. 2024-08-08 08:00:25 +02:00
Rolf Bjarne Kvinge 6d7193262a [net9.0] Merge main into net9.0. 2024-08-07 15:21:12 +02:00
Rolf Bjarne Kvinge 7e54b16412
[dotnet] Delay computing trimming options until MAUI has had a chance to change the default. (#20970)
See comment in code for a deeper explanation.

Partial fix for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2053707.

---------

Co-authored-by: Alex Soto <alex@soto.dev>
2024-08-07 14:43:53 +02:00
Rolf Bjarne Kvinge 772c7153c8
[net9.0] [dotnet] Delay computing trimming options until MAUI has had a chance to change the default. (#20971)
See comment in code for a deeper explanation.

Partial fix for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2053707.
2024-08-07 14:43:15 +02:00
Rolf Bjarne Kvinge 2dc0efef4d [xcode16] Merge main into xcode16. 2024-08-06 19:53:09 +02:00
Rolf Bjarne Kvinge 47137d670a
[xtro] Enable Mac Catalyst. (#20974)
It didn't work at some point, but seems to be working fine now.

---------

Co-authored-by: Alex Soto <alex@soto.dev>
2024-08-06 19:49:43 +02:00
dotnet-maestro[bot] a9c949762e
[net9.0] Update dependencies from dotnet/sdk (#20949)
This pull request updates the following dependencies

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 9.0.0-preview.7.24366.18 to 9.0.0-rc.1.24378.5 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.AspNetCore.App.Ref**: from 9.0.0-rc.1.24375.10 to 9.0.0-rc.1.24379.7 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.7.24366.18 to 9.0.0-rc.1.24378.5 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: from 9.0.0-preview.7.24365.1 to 9.0.0-rc.1.24373.3 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.7.24366.18 to 9.0.0-rc.1.24378.5 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.DotNet.Cecil**: from 0.11.5-alpha.24324.1 to 0.11.5-alpha.24365.1 (parent: Microsoft.NETCore.App.Ref)

## From https://github.com/dotnet/sdk

- **Subscription**: 3727984b-7a79-4ba3-37dd-08dbe6bddf31
- **Build**: 20240730.5
- **Date Produced**: July 30, 2024 10:19:29 PM UTC
- **Commit**: 10803eca35eef6e685924886ba74caf0bd9439ad
- **Branch**: refs/heads/main

- **Updates**:
  - **VS.Tools.Net.Core.SDK.Resolver**: [from 9.0.100-rc.1.24377.4 to 9.0.100-rc.1.24380.5][16]
  - **Microsoft.NET.ILLink.Tasks**: [from 9.0.0-preview.7.24366.18 to 9.0.0-rc.1.24378.5][17]
  - **Microsoft.AspNetCore.App.Ref**: [from 9.0.0-rc.1.24375.10 to 9.0.0-rc.1.24379.7][18]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.7.24366.18 to 9.0.0-rc.1.24378.5][17]
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: [from 9.0.0-preview.7.24365.1 to 9.0.0-rc.1.24373.3][19]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.7.24366.18 to 9.0.0-rc.1.24378.5][17]
  - **Microsoft.DotNet.Cecil**: [from 0.11.5-alpha.24324.1 to 0.11.5-alpha.24365.1][20]

[16]: 74dafbfb0c...10803eca35
[17]: 1f70f0cc66...0912e94a6c
[18]: 98ee50279a...27f2a011a4
[19]: 99ea0c06b8...40781ca2fc
[20]: 7e4af02521...e05101e694

---------

Co-authored-by: Alex Soto <alex@soto.dev>
2024-08-05 20:16:13 +02:00
Alex Soto b4dff0b30a Merge remote-tracking branch 'origin/main' into dev/alex/net9-main-merge 2024-07-31 09:01:02 -04:00
Alex Soto 76769f17d5
[main] Enable dedup only when targeting arm64 (#20953)
Backport of https://github.com/xamarin/xamarin-macios/pull/20952

--------

## Description

Previous fix https://github.com/xamarin/xamarin-macios/pull/20945 did
not take into account that when we target non arm64 apple mobile
platforms we are using `MONO_AOT_MODE_INTERP_ONLY` which cannot use
dedup optimization as it discards AOT images during runtime.

## Changes

- Enable dedup only when targeting ARM64
- Fix tests to cover builds for both ARM64 and X64 builds

Finally, the change was tested against MAUI iossimulator-x64 template
app

---------

Co-authored-by: Ivan Povazan <ivan.povazan@gmail.com>
Co-authored-by: Ivan Povazan <55002338+ivanpovazan@users.noreply.github.com>
2024-07-30 08:10:22 -04:00
Ivan Povazan 40a8eba6bf
Do not enable dedup when targeting `maccatalyst-x64` (#20945)
## Description

This is a follow-up PR to:
https://github.com/xamarin/xamarin-macios/pull/20936

We should not enable dedup when targeting `maccatalyst-x64` because in
case when the project file specifies
`MtouchInterpreter=all,-System.Private.CoreLib`, the build will run the
full AOT compiler with interpreter enabled.

In this setup the runtime is configured to run in interp only mode:
97a91cc4e3/tools/common/Target.cs (L812-L813)

which means that during runtime, AOT images will be ignored - aot
runtime will load them but mark them as unusuable since they are
compiled with `full` compiler switch and the code falls back to
interpreter (ref:
efebf202a4/src/mono/mono/mini/aot-runtime.c (L2131-L2148)
)

This is problematic for the `aot-instances` container image, which has a
special handling at the runtime and does not accept it to be marked as
unusable (we might want to revisit this in the future):

efebf202a4/src/mono/mono/mini/aot-runtime.c (L2527-L2529)

## Changes

This PR disables dedup optimization when targeting `maccatalyst-x64` and
updates the required tests to match the behavior.

---

Backports:

- [x] https://github.com/xamarin/xamarin-macios/pull/20946
- [x] Original reenabling of dedup for .NET 9 already includes these
changes: https://github.com/xamarin/xamarin-macios/pull/20941

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2024-07-26 18:44:07 -04:00
Alex Soto 73038144e7
[net9.0] Reenable dedup optimization for all AOT modes (#20941)
Backport of #20936

---

## Description

As part of the fix for: https://github.com/dotnet/runtime/issues/99248
we disabled dedup optimization in partial/hybrid AOT mode (when both
interpreter and AOT compiler are enabled). This change got backported to
.NET 8 and with the latest servicing release regressed build times and
app sizes significantly as reported in:
https://github.com/xamarin/xamarin-macios/issues/20848

However, it turns out that disabling dedup optimization is not required
to fix https://github.com/dotnet/runtime/issues/99248 but instead we
should correct the Xamarin SDK integration with this optimization which
this PR is doing. The following section describes the initial problem in
more details.

## Overview of AOT modes and dedup optimization

When the repro project from
https://github.com/dotnet/runtime/issues/99248 is built with dedup
enabled in hybrid AOT+interpreter mode, the app crashes with:
```
024-07-23 14:32:37.524110+0200 IvansApp[12711:20244208] debug: AOT NOT FOUND: (wrapper other) object:gsharedvt_out_sig (intptr).
2024-07-23 14:32:37.524120+0200 IvansApp[12711:20244208] error: * Assertion at /Users/ivan/repos/runtime-mono-iOS/src/mono/mono/mini/interp/interp.c:2667, condition `is_ok (error)' not met, function:init_jit_call_info, Attempting to JIT compile method '(wrapper other) void object:gsharedvt_out_sig (intptr)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
```

To track down why these wrappers which are used to transition from
interpreter to AOT code, are not generated we need to understand when
they are compiled in different AOT modes with and without dedup
optimization enabled:

- In full AOT setup - all assemblies AOT compiled
    - `gsharedvt_out_sig` methods are never generated

- In hybrid AOT + interpreter setup - all assemblies AOT compiled:
`MtouchInterpreter=-all`
    - Dedup OFF:
- `gsharedvt_out_sig` methods are generated in AOT images of every
assembly (to enable interpreter calling into each specific assembly -
here wrappers with same signatures are duplicated)
    - Dedup ON:
- `gsharedvt_out_sig` methods are generated only in `aot-instances` AOT
image
- during AOT compilation of individual assemblies generation of
`gsharedvt_out_sig` is skipped
- during AOT compilation of `aot-instances` assembly we collect all
`gsharedvt_out_sig` variants from the full program scope and generate
code for them in `aot-instances` AOT image

- In hybrid AOT + interpreter setup - all assemblies interpreted except
a given assembly: `MtouchInterpreter=all,-MyAssembly`
    - Dedup OFF:
- `gsharedvt_out_sig` methods are generated in AOT image of `MyAssembly`
(to enable interpreter calling into it)
    - Dedup ON: <- $${\color{red} ISSUE }$$ 
- `gsharedvt_out_sig` methods *should* be generated only in
`aot-instances` AOT image, but the `aot-instances` image is missing
    - explanation:
- what happens is that generation of `gsharedvt_out_sig` is skipped
during AOT compilation of `MyAssembly` (as expected).
- But, the build does not mark `aot-instances` assembly as the one that
should be AOT compiled.
- The reason for this is that we have a global `_IsDedupEnabled` flag,
but when custom linker step analysis `aot-instances.dll` it does not see
it as an assembly which should not be interpreted.
- To explain that better: we mark *all* assemblies as to be interpreted
(via: `MtouchInterpreter=all`), but exclude only `MyAssembly` (via:
`MtouchInterpreter=all,-MyAssembly`).
- So when custom linker step processes `aot-instaces.dll` it treats it
as an assembly to be interpreted, so it does not mark it for AOT
compilation.
- This further results with `aot-instances` AOT image missing, and all
the methods which we skipped during AOT compilation never get generated.

## The fix

To fix this and address regressions reported in:
https://github.com/xamarin/xamarin-macios/issues/20848 we are reenabling
dedup optimization whenever AOT compilation is requested and fixing the
issue where the custom linker step for generating AOT parameters always
treates the dedup assembly as the one to be AOTed.

Once approved this should be backported to .NET 8 as servicing releases
are also affected with it.

---------

Co-authored-by: Ivan Povazan <ivan.povazan@gmail.com>
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2024-07-26 14:47:25 -04:00
Ivan Povazan 97a91cc4e3
Reenable dedup optimization for all AOT modes (#20936)
## Description

As part of the fix for: https://github.com/dotnet/runtime/issues/99248
we disabled dedup optimization in partial/hybrid AOT mode (when both
interpreter and AOT compiler are enabled). This change got backported to
.NET 8 and with the latest servicing release regressed build times and
app sizes significantly as reported in:
https://github.com/xamarin/xamarin-macios/issues/20848

However, it turns out that disabling dedup optimization is not required
to fix https://github.com/dotnet/runtime/issues/99248 but instead we
should correct the Xamarin SDK integration with this optimization which
this PR is doing. The following section describes the initial problem in
more details.

## Overview of AOT modes and dedup optimization

When the repro project from
https://github.com/dotnet/runtime/issues/99248 is built with dedup
enabled in hybrid AOT+interpreter mode, the app crashes with:
```
024-07-23 14:32:37.524110+0200 IvansApp[12711:20244208] debug: AOT NOT FOUND: (wrapper other) object:gsharedvt_out_sig (intptr).
2024-07-23 14:32:37.524120+0200 IvansApp[12711:20244208] error: * Assertion at /Users/ivan/repos/runtime-mono-iOS/src/mono/mono/mini/interp/interp.c:2667, condition `is_ok (error)' not met, function:init_jit_call_info, Attempting to JIT compile method '(wrapper other) void object:gsharedvt_out_sig (intptr)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
```

To track down why these wrappers which are used to transition from
interpreter to AOT code, are not generated we need to understand when
they are compiled in different AOT modes with and without dedup
optimization enabled:

- In full AOT setup - all assemblies AOT compiled
    - `gsharedvt_out_sig` methods are never generated

- In hybrid AOT + interpreter setup - all assemblies AOT compiled:
`MtouchInterpreter=-all`
    - Dedup OFF:
- `gsharedvt_out_sig` methods are generated in AOT images of every
assembly (to enable interpreter calling into each specific assembly -
here wrappers with same signatures are duplicated)
    - Dedup ON:
- `gsharedvt_out_sig` methods are generated only in `aot-instances` AOT
image
- during AOT compilation of individual assemblies generation of
`gsharedvt_out_sig` is skipped
- during AOT compilation of `aot-instances` assembly we collect all
`gsharedvt_out_sig` variants from the full program scope and generate
code for them in `aot-instances` AOT image

- In hybrid AOT + interpreter setup - all assemblies interpreted except
a given assembly: `MtouchInterpreter=all,-MyAssembly`
    - Dedup OFF:
- `gsharedvt_out_sig` methods are generated in AOT image of `MyAssembly`
(to enable interpreter calling into it)
    - Dedup ON: <- $${\color{red} ISSUE }$$ 
- `gsharedvt_out_sig` methods *should* be generated only in
`aot-instances` AOT image, but the `aot-instances` image is missing
    - explanation:
- what happens is that generation of `gsharedvt_out_sig` is skipped
during AOT compilation of `MyAssembly` (as expected).
- But, the build does not mark `aot-instances` assembly as the one that
should be AOT compiled.
- The reason for this is that we have a global `_IsDedupEnabled` flag,
but when custom linker step analysis `aot-instances.dll` it does not see
it as an assembly which should not be interpreted.
- To explain that better: we mark *all* assemblies as to be interpreted
(via: `MtouchInterpreter=all`), but exclude only `MyAssembly` (via:
`MtouchInterpreter=all,-MyAssembly`).
- So when custom linker step processes `aot-instaces.dll` it treats it
as an assembly to be interpreted, so it does not mark it for AOT
compilation.
- This further results with `aot-instances` AOT image missing, and all
the methods which we skipped during AOT compilation never get generated.

## The fix

To fix this and address regressions reported in:
https://github.com/xamarin/xamarin-macios/issues/20848 we are reenabling
dedup optimization whenever AOT compilation is requested and fixing the
issue where the custom linker step for generating AOT parameters always
treates the dedup assembly as the one to be AOTed.

Once approved this should be backported to .NET 8 as servicing releases
are also affected with it.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2024-07-25 19:50:21 -04:00
Alex Soto ce5350de25 Merge remote-tracking branch 'origin/main' into net9.0 2024-07-19 15:26:35 -04:00
Ivan Povazan 374e902075
NativeAOT: Enable building app extensions with NativeAOT (#20872)
### Description

This PR enables building app extensions with NativeAOT. 

App extensions are class libraries and to build them with NativeAOT we
must not specify `CustomNativeMain=true`. If we do, ILC would expect
that the input assembly has a managed Main as the module entry point.

Additionally, when building class libraries (with the absence of a
managed Main entry point), our static reference from:

2e5ef1eb1c/runtime/nativeaot-bridge.m (L39)

requires build-time symbol resolution. To avoid linking errors, we
generate an empty `__managed__Main`
in the native bootstrapping code of the app extension (e.g., in
`main.arm64.mm`).

### Testing

The unit tests have been introduced to test building app extensions with
both Mono and NativeAOT.
Executing an iOS app TodayExtension built with NativeAOT has been
verified manually on an actual device.

--- 
Fixes: https://github.com/xamarin/xamarin-macios/issues/20653
2024-07-19 08:03:49 -04:00
Alex Soto 9fa7696a30 Fix tests 2024-07-17 15:44:00 -04:00
Alex Soto 5b72d86f02 Merge remote-tracking branch 'xamarin/main' into xcode16 2024-07-16 22:58:16 -04:00
Rolf Bjarne Kvinge e1290d2f15
[net9.0] Bump to Xcode 15.4 packages instead of Xcode 15.1 packages as the latest .NET 8 stable. (#20888)
This also required some changes to the generation of the workload
manifest files, since the Xcode 15.4 packages support multi-targeting.

---------

Co-authored-by: Alex Soto <alex@soto.dev>
2024-07-15 13:55:15 -04:00
Rolf Bjarne Kvinge d19f9508c2
[xcode16] Bump to Xcode 16 beta 3. (#20850) 2024-07-13 09:43:49 -04:00
Rolf Bjarne Kvinge f4bdeb661a
[MediaAccessibility] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20894)
Note: there were no changes in beta 2 or beta 3.
2024-07-13 09:39:43 -04:00
Rolf Bjarne Kvinge acb99cb31b
[LinkPresentation] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20887)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 14:48:36 -04:00
Rolf Bjarne Kvinge 1506abdd5e
[FileProvider] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20890)
Note: there were no changes in beta 3.
2024-07-12 14:47:27 -04:00
Rolf Bjarne Kvinge d1ec7a793f
[tests] Fix determining whether we're building for the simulator or not. (#20852)
The 'Platform=iPhoneSimulator' property is not necessarily set for .NET
projects, so don't rely on it.
2024-07-12 18:46:17 +02:00
Rolf Bjarne Kvinge 9201eaec21
[CallKit] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20858)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:46:00 +02:00
Rolf Bjarne Kvinge 319e5eb87b
[Intents] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20881)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:45:27 +02:00
Rolf Bjarne Kvinge e590cc8340
[IOSurface] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20879)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:45:05 +02:00
Rolf Bjarne Kvinge 06517e1a76
[ImageIO] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20875)
Note: there were no changes in beta 3.
2024-07-12 18:44:45 +02:00
Rolf Bjarne Kvinge 168bac88d7
[GameController] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20874)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:44:23 +02:00
Rolf Bjarne Kvinge ec61254a7f
[DeviceDiscoveryExtension] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20870)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:44:05 +02:00
Rolf Bjarne Kvinge 9a78097226
[CoreTelephony] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20863)
Note: there were no changes in beta 2 and beta 3.
2024-07-12 18:43:44 +02:00
Rolf Bjarne Kvinge 9f3b144c87
[CoreLocation] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20864)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:42:34 +02:00
Rolf Bjarne Kvinge 317c07b59c
[AVFoundation] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes (from AVFAudio only). (#20851)
Note: there were no changes in beta 2 and beta 3 in AVFAudio.
2024-07-12 18:42:11 +02:00
Rolf Bjarne Kvinge 17acc8eb64
[CoreBluetooth] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20859)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:41:40 +02:00
Rolf Bjarne Kvinge 0ccad3e8ff
[Contacts] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20860)
Note: there were no changes in beta 2 and beta 3.
2024-07-12 18:41:19 +02:00
Rolf Bjarne Kvinge c2bb0a04b5
[CoreMotion] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20862)
Note: there were no changes in beta 3.
2024-07-12 18:40:40 +02:00
Rolf Bjarne Kvinge 01400da900
[xtro] Get libclang-mono.dylib from where sharpie is. (#20815)
This fixes a crash when using a locally built sharpie - in which case we
shouldn't use the system libmono-clang.dylib, but the locally built one too.
2024-07-12 18:40:21 +02:00
Rolf Bjarne Kvinge 20a18e37c3
[AVKit] Implement Xcode 15 + Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20849)
Note: there were no changes in beta 2 or beta 3.
2024-07-12 18:39:56 +02:00
Rolf Bjarne Kvinge 451d2dd71e
[AutomaticAssessmentConfiguration] Implement Xcode 16.0 beta 1, beta 2 and beta 3 changes. (#20847)
Note: there were no changes in beta 2 and beta 3.
2024-07-12 18:39:33 +02:00
Alex Soto 4486eb3b9f Merge remote-tracking branch 'xamarin/main' into dev/alex/main-net9.0 2024-07-11 18:53:54 -04:00
Rolf Bjarne Kvinge 219c74a3c4
[xcode15.4] Update bindings to Xcode 15.4 (#20865)
Co-authored-by: Alex Soto <alex@soto.dev>
2024-07-11 14:09:52 -04:00
dotnet-maestro[bot] dfa48ff895
[net9.0] Update dependencies from dotnet/sdk (#20794)
This pull request updates the following dependencies

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 9.0.0-preview.6.24319.11 to 9.0.0-preview.7.24357.2 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.AspNetCore.App.Ref**: from 9.0.0-preview.6.24320.4 to 9.0.0-preview.7.24360.7 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.6.24319.11 to 9.0.0-preview.7.24357.2 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: from 9.0.0-preview.6.24317.2 to 9.0.0-preview.7.24319.4 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.6.24319.11 to 9.0.0-preview.7.24357.2 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.DotNet.Cecil**: from 0.11.4-alpha.24313.1 to 0.11.5-alpha.24324.1 (parent: Microsoft.NETCore.App.Ref)

## From https://github.com/dotnet/sdk

- **Subscription**: 3727984b-7a79-4ba3-37dd-08dbe6bddf31
- **Build**: 20240711.1
- **Date Produced**: July 11, 2024 8:29:26 AM UTC
- **Commit**: 81ac886071828da7f14d0c26d731ac06abd0c7f6
- **Branch**: refs/heads/main

- **Updates**:
  - **VS.Tools.Net.Core.SDK.Resolver**: [from 9.0.100-preview.7.24323.5 to 9.0.100-preview.7.24361.1][58]
  - **Microsoft.NET.ILLink.Tasks**: [from 9.0.0-preview.6.24319.11 to 9.0.0-preview.7.24357.2][59]
  - **Microsoft.AspNetCore.App.Ref**: [from 9.0.0-preview.6.24320.4 to 9.0.0-preview.7.24360.7][60]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.6.24319.11 to 9.0.0-preview.7.24357.2][59]
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: [from 9.0.0-preview.6.24317.2 to 9.0.0-preview.7.24319.4][61]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.6.24319.11 to 9.0.0-preview.7.24357.2][59]
  - **Microsoft.DotNet.Cecil**: [from 0.11.4-alpha.24313.1 to 0.11.5-alpha.24324.1][62]

[58]: ea9243f9cb...81ac886071
[59]: 117cfccdd7...4e278fe17f
[60]: 613c1e990b...71b5ef3f5c
[61]: 9880d891dd...ffe9afdc04
[62]: d145726036...7e4af02521
2024-07-11 19:58:14 +02:00
Alex Soto 2e5ef1eb1c
[xcode15.3] Bump to Xcode 15.3 bindings (#20780)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2024-07-11 11:41:31 +02:00
Rolf Bjarne Kvinge 4fd259d4dc
[tests] Simplify NWPathTest.EnumerateGatewayTest (#20853)
* Remove code to test NWPath.EnumerateInterfaces, because this method is already tested elsewhere.
* Assume that if the test fails to find any gateways, it might be because the
  current machine doesn't have any (which happens on one of my machines), and
  in that case ignore the test.
2024-07-10 21:40:50 +02:00
Rolf Bjarne Kvinge b3fc0d93ec
[src] Implement a more generic way of calling objc_msgSend with variadic arguments. (#20832)
Move the architecture-specific vargs implementation of UIAppearance.GetAppareance into a more generic way of calling objc_msgSend with variadic arguments.

This prepares the way for more APIs with variadic arguments (which is coming in Xcode 16).
2024-07-10 21:19:51 +02:00
Rolf Bjarne Kvinge 12264008df [xcode16] Merge main into xcode16. 2024-07-10 18:01:39 +02:00
Rolf Bjarne Kvinge ed77cd6224
[dotnet] Limit custom dotnet/runtime selection to the current .NET version. (#20840)
This way any tests using the previous .NET version still works.
2024-07-10 16:30:34 +02:00
Rolf Bjarne Kvinge 72d87db71c
[Xcode16] Allow the runtime to compile with Xcode 16 beta 2. (#20844)
Add support for Xcode 16 beta 2.

---------

Co-authored-by: Manuel de la Pena Saenz <mandel@microsoft.com>
2024-07-10 13:00:51 +02:00
Rolf Bjarne Kvinge 7ddf1284a5
[dotnet] Force 'AppendRuntimeIdentifierToOutputPath=true' for the inner build of universal apps. (#20839)
When building universal apps, each inner build must add the runtime identifier to the output path, otherwise the inner builds may conflict with eachother, overwriting eachother's files.

That's bad.

So we explicitly set `AppendRuntimeIdentifierToOutputPath` to `true` when building inner builds.
2024-07-10 13:00:05 +02:00
Rolf Bjarne Kvinge 180a7e0bb9
[tests] Fix a couple of minor issues. (#20843)
* xtro: Fix how we build the u2todo project to actually build the correct project.
* Don't import eng/Versions.props in several test projects, it's already imported in a Directory.Build.props further up the directory hierarchy.
2024-07-10 12:57:30 +02:00
Rolf Bjarne Kvinge 886d48d015 Merge remote-tracking branch 'origin/xcode16' into dev/rolf/xcode16-rolf 2024-07-09 17:56:13 +02:00
Rolf Bjarne Kvinge 4c5d826ad3 Update xtro. 2024-07-09 16:33:03 +02:00
Rolf Bjarne Kvinge c81cb4aa77
[xtro] Move xtro-sharpie.csproj to its own directory. (#20825)
This will make it easier to eventually migrate this project to .NET.
2024-07-09 16:25:39 +02:00
Rolf Bjarne Kvinge 1520e0ebbc
[tests] Update 'KnownFrameworkReference' and 'KnownRuntimePack' to the reference the correct dotnet/runtime version when using a custom dotnet/runtime. (#20838) 2024-07-09 14:17:58 +02:00
Rolf Bjarne Kvinge 7a26aaeb63 Add Xcode 16 b1 todos. 2024-07-09 13:11:11 +02:00
Rolf Bjarne Kvinge 6b427362a2 [xtro] Remove todos for deprecated APIs. 2024-07-09 10:39:38 +02:00
Rolf Bjarne Kvinge 1f6eff4529 [xtro] Bump Objective-Sharpie.
Also disable Objective-C modules when using sharpie, because clang fails to
compile the headers when modules are enabled for some reason.
2024-07-09 10:34:40 +02:00
Rolf Bjarne Kvinge c36628c001 [introspection] Add ignore for UITextLoupeSession's ctor. 2024-07-09 10:22:50 +02:00
Rolf Bjarne Kvinge 46fb027c3b [CoreImage] Implement Xcode 16.0 beta 1 and beta 2 changes.
Note: there were no beta 2 changes.
2024-07-09 10:22:50 +02:00
Rolf Bjarne Kvinge 2340af0510 [introspection] Update exceptions for Xcode 16 beta 1. 2024-07-09 10:22:37 +02:00
Rolf Bjarne Kvinge d5106e5dad [AuthenticationServices] Add new protocol conformances in Xcode 16 beta 1 2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge 34a06c8d4e [msbuild] Fix computing target device for tvOS.
Also use a tvOS storyboard (and not an iOS storyboard) for tvOS test projects (or
alternatively no storyboard at all, whenever that's possible).
2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge 88ebfde8fa [tests] Adjust ProtocolTest to ignore any '?' attributes.
The '?' property attribute seems to be new in Xcode 16, and there's no
documentation about it, so ignore it.
2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge 0384a291bf [monotouch-test] Simplify CalendarTest to allow multiple values for EKCalendar.Immutable.
We don't really care about the value, and keeping track of whether the
calendar is immutable or not to assert the right value is time-consuming, so
just don't do that.
2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge e4bebf07d9 [tests] Implement Xcode 16 version check for TestRuntime.CheckXcodeVersion. 2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge 093b31097c [monotouch-test] Misc adjustment for Xcode 16 beta 1. 2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge 33432692f1 [monotouch-test] Run AudioComponentTest.Validate in a background thread.
It hangs for me, which makes the entire test run hang if it happens on the main thread.
2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge 464c7003f5 [tests] Ignore a watchOS test that makes clang crash. 2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge d1d7e74f1f [tests] Skip the linker warning about -ld_classic going away in legacy Xamarin tests. 2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge 29ad60906a [monotouch-test] Adjust MonoTouchFixtures.HealthKit.CdaDocumentSampleTest to expect various exception messages.
Apple has flip-flopped between the two possible exception messages depending
on platform and OS version, and it's difficult and annoying to keep track.

So just don't: always accept either exception message. It doesn't really matter which one we get.s
2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge bb1171fb03 [tests] Fix the GetMlaunchRunArguments test to not require an update on every OS bump. 2024-07-09 10:22:36 +02:00
Rolf Bjarne Kvinge fb4215105d [tests] Update cecil-tests with known documentation failures. 2024-07-09 10:22:35 +02:00
Rolf Bjarne Kvinge 4b5e6c9b2d Xcode 16, here we come 2024-07-09 10:22:35 +02:00
Rolf Bjarne Kvinge 0e7a808958 [net9.0] Merge main into net9.0. 2024-07-08 18:45:06 +02:00
Rolf Bjarne Kvinge 26ede64161
[tests] Make the generator tests in the Makefile use the locally installed Xamarin.iOS/Xamarin.Mac. (#20821) 2024-07-08 18:30:36 +02:00
Rolf Bjarne Kvinge ddaf7822f9
[devops] Copy XMA's NuGet.config to XMA's home directory. (#20819)
This way we're using the same NuGet configuration even when executing outside
of XMA's .NET directory.

Also collect a bit more diagnostic info.
2024-07-08 18:30:21 +02:00
Rolf Bjarne Kvinge 544b96817f
[xtro] Fix version comparison with macOS 10.7. (#20816)
This also required updating the xtro files.
2024-07-08 18:30:14 +02:00
Rolf Bjarne Kvinge 9582522ccb
[xtro] Convert most projects to .NET projects. (#20760)
Convert all projects except xtro-sharpie.csproj to .NET projects.
xtro-sharpie.csproj can't be converted yet, because it depends on
Objective-Sharpie, which hasn't been converted yet.
2024-07-05 14:54:29 +02:00
Rolf Bjarne Kvinge c930ab321b
[monotouch-test] Remove ignore for Mac Catalyst. (#20810)
Apple says the bug on their side causing a runtime crash has been fixed since
macOS 12, so unignore the code and add a version check for macOS 12.

Fixes https://github.com/xamarin/maccore/issues/2345.
2024-07-04 14:16:38 +02:00
Rolf Bjarne Kvinge 6da82734ee
[src/tools] Propagate the BackwardsCompatibleCodeGeneration field from Protocol attributes in bindings to the generated code. (#20804)
Also fix the MustSetBackwardsCompatibleCodeGenerationToFalse test to skip
protocols that actually set BackwardsCompatibleCodeGeneration=false.
2024-07-03 20:18:13 +02:00
Rolf Bjarne Kvinge 323d28c220
[Foundation] Make the generic collection classes' generic GetEnumerator methods public. (#20808)
When finding an enumerator for the given code:

```cs
var collection = new NSSet<NSNumber> ();
foreach (var item in collection) {
	// ...
}
```

the C# compiler will first look for any `GetEnumerator` methods. The non-generic `NSSet` class defines a `IEnumerator<NSObject> GetEnumerator<NSObject> ()` method, which, since the generic `NSSet<T>` class doesn't define such a method, is selected.

The end result is that the type of the foreach element is `NSObject`
(`GetEnumerator`'s return type') - which is somewhat unexpected:

```cs
var collection = new NSSet<NSNumber> ();
foreach (var item in collection) {
	Console.WriteLine (item.LongValue); // error CS1061: 'NSObject' does not contain a definition for 'LongValue'
}
```

The fix is to define a  `IEnumerator<T> GetEnumerator<T> ()` method in the
generic `NSSet<T>` class, which the C# will find and choose over the base
class' method. Then the type of the foreach element is the correct type, and
the following code works:

```cs
var collection = new NSSet<NSNumber> ();
foreach (var item in collection) {
	Console.WriteLine (item.LongValue); // it works!
}
```

Do this for all our generic collection classes.

Also document these methods + all the other public `GetEnumerator` methods.
2024-07-03 20:16:53 +02:00
Šimon Rozsíval 68897de20f
[net9.0] Do not suppress trim analysis warnings when NativeAOT is enabled (#20767)
We noticed we weren't seeing trim analysis warnings in VS Code when
PublishAot was set to true. There was a recent change that correctly
disabled the suppressions when TrimMode is full. We need to make sure
that we're also getting the trim analysis warnings in dotnet build with
PublishAot but suppress them when publishing (in that case the warnings
will come later from ILC). This PR aligns the behavior of
PublishAot=true and TrimMode=true in debug builds.
2024-07-03 18:22:44 +02:00
Rolf Bjarne Kvinge a28cf64a8c
[msbuild] Don't support RuntimeIdentifiers for Hot Restart. (#20750)
There's no need to support `RuntimeIdentifiers` (plural) for Hot Restart
(because we don't have any scenarios where multiple runtime identifiers
applies to iOS; a single runtime identifier can always be used).

Adding support would make our code base more complex, so just avoid it by
showing an early error if someone tries (which is likely to be accidental
anyways).

This way we show an actionable error message for a scenario customers will
probably be confused about (because the build would fail in rather
inexplicable ways) if they run into it.

Partial fix for https://github.com/xamarin/xamarin-macios/issues/19262.
2024-07-01 19:26:57 +02:00
Rolf Bjarne Kvinge dd50b20972 [net9.0] Merge main into net9.0. 2024-06-28 12:40:06 +02:00
Rolf Bjarne Kvinge 5f7792ab91
[tests] Fix BuildBindingsTest expectations. (#20768)
Fix BuildBindingsTest expectations to expect the resources in either a sidecar or a zipped sidecar.

Fixes this test failure:

    Xamarin.Tests.DotNetProjectTest.BuildBindingsTest(TVOS): Bundle existence
    Expected: file or directory exists
    But was: "/Users/builder/azdo/_work/1/s/xamarin-macios/tests/bindings-test/dotnet/tvOS/bin/Debug/net8.0-tvos/bindings-test.resources.zip"
2024-06-27 09:38:12 +02:00
Rolf Bjarne Kvinge 9b7ff19b47
[src] Fix definition of AVSampleCursorAudioDependencyInfo for Mac Catalyst. (#20781)
We need the backwards compatible code for the
AVSampleCursorAudioDependencyInfo struct (i.e. use the
AVSampleCursorAudioDependencyInfo_Blittable version), so adjust the ifdefs
accordingly - which wasn't obvious at first, because __IOS__ is defined for
Mac Catalyst.

Also fix the corresponding test, because it would cache the result of
computing whether a struct was blittable or not, but that's not true across
platforms ("AVSampleCursorAudioDependencyInfo" is blittable on iOS, but not on
Mac Catalyst). The result was that the test would incorrectly pass if we
processed Microsoft.iOS.dll before Microsoft.MacCatalyst.dll. The fix is to
cache per platform, instead of using a global cache.
2024-06-26 14:17:58 +02:00
Rolf Bjarne Kvinge 884522f678 [net9.0] Merge main into net9.0. 2024-06-25 17:30:49 +02:00
dotnet-maestro[bot] 4a9bfcb154
[net9.0] Update dependencies from dotnet/sdk (#20621)
This pull request updates the following dependencies

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 9.0.0-preview.5.24256.1 to 9.0.0-preview.6.24281.1 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.AspNetCore.App.Ref**: from 9.0.0-preview.5.24256.2 to 9.0.0-preview.6.24305.3 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.5.24256.1 to 9.0.0-preview.6.24281.1 (parent: VS.Tools.Net.Core.SDK.Resolver)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: from 9.0.0-preview.5.24223.2 to 9.0.0-preview.6.24277.2 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.5.24256.1 to 9.0.0-preview.6.24281.1 (parent: VS.Tools.Net.Core.SDK.Resolver)

## From https://github.com/dotnet/sdk

- **Subscription**: 3727984b-7a79-4ba3-37dd-08dbe6bddf31
- **Build**: 20240605.17
- **Date Produced**: June 5, 2024 11:40:08 PM UTC
- **Commit**: 6ecc573c92a1237627b37310c6aec65ff3caacc8
- **Branch**: refs/heads/main

- **Updates**:
  - **VS.Tools.Net.Core.SDK.Resolver**: [from 9.0.100-preview.5.24262.2 to 9.0.100-preview.6.24305.17][65]
  - **Microsoft.NET.ILLink.Tasks**: [from 9.0.0-preview.5.24256.1 to 9.0.0-preview.6.24281.1][66]
  - **Microsoft.AspNetCore.App.Ref**: [from 9.0.0-preview.5.24256.2 to 9.0.0-preview.6.24305.3][67]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.5.24256.1 to 9.0.0-preview.6.24281.1][66]
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: [from 9.0.0-preview.5.24223.2 to 9.0.0-preview.6.24277.2][68]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.5.24256.1 to 9.0.0-preview.6.24281.1][66]

[65]: 1741345c63...6ecc573c92
[66]: 84b3339505...3750ac5161
[67]: da3aa27233...8adff2c3cf
[68]: 53288f87c5...fae2c95346

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
2024-06-25 13:49:44 +02:00
Rolf Bjarne Kvinge 2f9ddc1933
[Foundation] Add missing properties to NSCharacterSet. Fixes #20745. (#20761)
Fixes https://github.com/xamarin/xamarin-macios/issues/20745.
2024-06-21 18:37:16 +02:00
Rolf Bjarne Kvinge 7cb7f705ca [net9.0] Merge main into net9.0. 2024-06-21 11:19:27 +02:00
Rolf Bjarne Kvinge 10f3b5ae32
[tests] Convert the testgenerator.csproj to a .NET project. (#20740) 2024-06-19 15:10:54 +02:00
Rolf Bjarne Kvinge 6c2a7a9eac
[msbuild] The DTPlatformName is supposed to be 'macosx' for Mac Catalyst. (#20720)
Change how we compute DTPlatformName so that it's 'macosx' for Mac Catalyst.
The PlatformUtils.GetTargetPlatform returns SdkPlatform for all platforms
except Mac Catalyst, where it returns the same as for macOS (i.e. 'macosx').
It also returns a lowercased value, so we don't need to do that either.

This is a partial fix for https://github.com/xamarin/xamarin-macios/issues/20714.
2024-06-17 20:19:06 +02:00
Rolf Bjarne Kvinge e7586e4411 [net9.0] Merge main into net9.0. 2024-06-12 15:08:25 +02:00