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

5605 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 5a0c317d06
[tests] Make the Bug2000_NSPersistentStoreCoordinator test use a process-unique test file name. Fixes #xamarin/maccore@2515. (#14119)
Make the Bug2000_NSPersistentStoreCoordinator test use a test file name that
contains the process id, so that multiple test processes at the same time
don't stomp on eachother.

Fixes https://github.com/xamarin/maccore/issues/2515.
2022-02-10 15:25:55 +01:00
Rolf Bjarne Kvinge 808a61a12b
[msbuild] Make sure to set 'ResolveAssemblyConflicts=true' before importing Microsoft.CSharp.targets. Fixes #11691. (#14109)
We must set `ResolveAssemblyConflicts=true` before loading
Microsoft.Common.targets (which is loaded by Microsoft.CSharp.targets),
because otherwise we won'd do any conflict resolution at all, since the
variable isn't 'true' when it needs to be.

Also add test.

Fixes https://github.com/xamarin/xamarin-macios/issues/11691.
2022-02-09 14:07:35 -05:00
Rolf Bjarne Kvinge 382074bbb8
[bgen] Make sure to render nint/nuint in delegates as nint/nuint for .NET. Fixes #14107. (#14112)
This makes us render this:

    public delegate nfloat NSTableViewColumnWidth(NSTableView tableView, nint column);

instead of this:

    public delegate nfloat NSTableViewColumnWidth(NSTableView tableView, IntPtr column);

Fixes https://github.com/xamarin/xamarin-macios/issues/14107.
2022-02-09 13:17:48 -05:00
Rolf Bjarne Kvinge 5e462b1c21
[dotnet] Fix non-bundling of debug files for release builds. Fixes #14085. (#14103)
Fixes https://github.com/xamarin/xamarin-macios/issues/14085.
2022-02-09 16:46:04 +01:00
Rolf Bjarne Kvinge 06100d8dca
[xtro] Update legacy annotations to talk about .NET instead of XAMCORE_4_0. (#14094)
This makes the XAMCORE_4_0 list in our source code substantially smaller.
2022-02-09 08:27:46 +01:00
Rolf Bjarne Kvinge 305ecde2cd
[tests] Adopt XAMCORE_4_0 changes for introspection in .NET. (#14098)
Co-authored-by: Alex Soto <alex@alexsoto.me>
2022-02-09 08:26:37 +01:00
Filip Navara 0622ae4af2
Fix GC issue on CoreCLR where finalized objects are returned by Runtime.GetNSObject (#14070)
Fixes race condition where finalized objects are resurrected by the finalizer and for a brief moment `Runtime.TryGetNSObject`/`Runtime.GetNSObject` would return them even though a new instance is supposed to be used. In multi-threaded scenarios this would result in reused objects (same native handle) to suddenly become invalid when the UI thread processes the delayed finalization.

Fixes #13921
2022-02-08 11:08:44 +01:00
Rolf Bjarne Kvinge 5eda463eaf
[Foundation] Remove a WebKit workaround for NSProxy on tvOS in .NET. (#14089)
The WebKit framework doesn't exist on tvOS.
2022-02-08 10:48:40 +01:00
Rolf Bjarne Kvinge 0fff3cbea0
[Foundation] Add strongly typed version of NSUndoManager.RunLoopModes for .NET. (#14040) 2022-02-08 10:40:46 +01:00
Rolf Bjarne Kvinge a5855f6f88
[JavaScriptCore] Bind JSValue.ToArray as NSArray in .NET. Fixes #12549. (#14090)
Fixes https://github.com/xamarin/xamarin-macios/issues/12549.
2022-02-08 10:39:14 +01:00
Rolf Bjarne Kvinge 0df9fa98ef
[UIKit] Implement the UIResponderStandardEditActions protocol. (#14095)
Implement the UIResponderStandardEditActions protocol, move the
corresponding API from UIResponder there, and make sure UIResponder implements
the new UIResponderStandardEditActions protocol (which should make this move a
non-breaking change, since the protocol is inlined in UIResponder).
2022-02-08 10:38:28 +01:00
Rolf Bjarne Kvinge 2d81a92270
[tests] Adopt XAMCORE_4_0 changes in monotouch-test .NET. (#14099) 2022-02-08 10:36:20 +01:00
Rolf Bjarne Kvinge 14dde5ca9a
[AppKit/Foundation] Make the "Color" suffix consistent in NSColor and UIColor properties. Fixes #7945. (#14080)
Make the "Color" suffix consistent in NSColor and UIColor properties (by removing the "Color" suffix for all such properties).

Fixes https://github.com/xamarin/xamarin-macios/issues/7945.
2022-02-08 09:15:21 +01:00
Rolf Bjarne Kvinge 352a0d818a
[dotnet] Include all files in the Resources subdirectory as bundle resources. Fixes #13808. (#14018)
Include all files in the project's Resources subdirectory as BundleResource
items (except .DS_Store files, which are pretty omnipresent on macOS).

Also, contrary to the other default includes, add a condition so files are
only included if we have a resource prefix (typically "Resources"), otherwise
the entire hard drive might be included, and that's not really what we want.

Fixes https://github.com/xamarin/xamarin-macios/issues/13808.
2022-02-07 18:55:31 +01:00
Rolf Bjarne Kvinge af541a05d8
[tests] Fix TOP declaration for a few makefiles. (#14086) 2022-02-07 18:38:01 +01:00
Rolf Bjarne Kvinge ef3b05478e
[tools/runtime] Enable exception marshalling by default for all platforms in .NET. (#14051)
When exception marshalling was originally implemented, for backwards
compatibility concerns it was only turned on by default for platforms that
really needed it (watchOS).

However, exception marshalling is by far the safest option, so in .NET we're
enabling it by default for all platforms (it's still possible to disable it
for those who wants to).

Ref: https://docs.microsoft.com/en-us/xamarin/ios/platform/exception-marshaling
2022-02-07 14:12:32 +01:00
Rolf Bjarne Kvinge eb281aefee
[AppKit] Make NSTextView implement the NSColorChanging protocol in .NET. (#14071)
Also change the NSColorChanging.ChangeColor method to not be deprecated
anymore, Apple's headers say nothing of the sort.
2022-02-07 08:06:24 +01:00
Rolf Bjarne Kvinge 18b53d8e4b
[xtro] Remove dead comment in ignore file. (#14078) 2022-02-07 08:04:34 +01:00
Rolf Bjarne Kvinge 6bef760049
[NetworkExtension] Remove fields from macOS that aren't in macOS for .NET. (#14082) 2022-02-07 08:03:53 +01:00
Marius Ungureanu dc9e080828
Implement IEquatable<T> on NSRange (#14083)
This avoids poor performance of GetHashCode and Equals that are used for the struct using reflection on the first field.
2022-02-07 07:52:45 +01:00
Rolf Bjarne Kvinge 534bf839c2
[Foundation] Fix signature for NSAttributedString.LowLevelGetAttributes to support no effectiveRange output. Fixes #13569. (#14069)
This makes it possible to override LowLevelGetAttributes to provide an
implementation, and be called with a NULL effectiveRange pointer.

Fixes https://github.com/xamarin/xamarin-macios/issues/13569.
2022-02-04 18:40:19 +01:00
Rolf Bjarne Kvinge 154bd6b22b
[AppKit] Implement the NSUserInterfaceValidation protocol for a few types in .NET. (#14036) 2022-02-04 08:27:29 +01:00
Rolf Bjarne Kvinge 8fafd7c806
[src] Remove CategoryAttribute.AllowStaticMembers and fix resulting issues in .NET. (#14038) 2022-02-04 08:26:56 +01:00
Rolf Bjarne Kvinge d766fe8c8b
[AppKit] Remove a few obsolete members in .NET (#14043) 2022-02-04 08:14:10 +01:00
Rolf Bjarne Kvinge 3a2acf9d99
[AppKit] Implement the NSUserActivityRestoring protocol. (#14045) 2022-02-04 08:06:25 +01:00
Rolf Bjarne Kvinge 0a10670d2e
[UIKit] Rename UISegmentedControl.DividerImageForLeftSegmentStaterightSegmentStatebarMetrics to UISegmentedControl.GetDividerImage in .NET. Fixes #6357. (#14059)
Also make the return value nullable since xtro says so.

Fixes https://github.com/xamarin/xamarin-macios/issues/6357.
2022-02-04 07:50:47 +01:00
Rolf Bjarne Kvinge 56313f896d
[AppKit] Use the correct interface for inlining protocols in our api definitions in .NET. (#14041)
Also update/fix code to show the corresponding warning in the generator, and
make a note of why MKUserLocation/MKAnnotation is special.
2022-02-03 17:56:20 +01:00
Rolf Bjarne Kvinge f0d4e1a1c7
[generator] Rework how we implement [Abstract] classes in .NET. Fixes #4969. (#14020)
We have a problem that's shown up a few times, where we're given an instance
of a native type, where the closest bound managed type is a type declared as
[Abstract] in the api definition. In this case, we want to create an instance
of the [Abstract] type to wrap the native instance, but that hasn't been
possible because the managed type is abstract.

Note: this is totally fine from the OS perspective: it might have created an
instance of a private subclass we haven't bound (or it might even be a public
subclass we just haven't bound yet).

The fix is to:

* Stop making [Abstract] classes in the api definition abstract classes in the generated code.
* Make the default constructor default to "protected" visibility for [Abstract] classes.

This way we can still create instances of these types at runtime when we need
them, but they must be subclassed in order to create a managed instance of
them.

Additionally I also had to make abstract members virtual for such types
(because otherwise the type would have to be abstract as well), and instead
throw a "You_Should_Not_Call_base_In_This_MethodException" in the
corresponding method implementations.

Fixes https://github.com/xamarin/xamarin-macios/issues/4969.
2022-02-03 08:25:07 +01:00
Rolf Bjarne Kvinge 363e58f079
[Foundation] Adopt more XAMCORE_4_0 changes in .NET. (#14017)
This is just removing obsolete API.
2022-02-02 17:24:51 +01:00
Rolf Bjarne Kvinge d5697a8867
[runtime] Use the full managed description (including inner exceptions) as the reason when creating an NSException from a managed exception. (#14002)
This makes diagnosing what happens much easier in some cases.

Exhibit A, pre fix:

    *** Terminating app due to uncaught exception 'ObjCRuntime.RuntimeException', reason: 'Failed to lookup the required marshalling information.
    Additional information:
    	Selector: conformsToProtocol:
    	Type: ViewController

Exhibit B, post fix:

    *** Terminating app due to uncaught exception 'ObjCRuntime.RuntimeException', reason: 'Failed to lookup the required marshalling information.
    Additional information:
    	Selector: conformsToProtocol:
    	Type: ViewController
     (ObjCRuntime.RuntimeException)
    Failed to get the 'this' instance in a method call to templ.ViewController.InvokeConformsToProtocol. (ObjCRuntime.RuntimeException)
       at Registrar.DynamicRegistrar.GetMethodDescriptionAndObject(Type type, IntPtr selector, Boolean is_static, IntPtr obj, IntPtr& mthis, IntPtr desc)
       at ObjCRuntime.Runtime.GetMethodAndObjectForSelector(IntPtr klass, IntPtr sel, Boolean is_static, IntPtr obj, IntPtr& mthis, IntPtr desc)
       at ObjCRuntime.Runtime.get_method_and_object_for_selector(IntPtr cls, IntPtr sel, Boolean is_static, IntPtr obj, IntPtr& mthis, IntPtr desc, IntPtr& exception_gchandle)
    Failed to marshal the Objective-C object 0x7f813fd2f470 (type: ViewController). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'templ.ViewController' does not have a constructor that takes one NativeHandle argument). (ObjCRuntime.RuntimeException)
       at ObjCRuntime.Runtime.MissingCtor(IntPtr ptr, IntPtr klass, Type type, MissingCtorResolution resolution)
       at ObjCRuntime.Runtime.ConstructNSObject[T](IntPtr ptr, Type type, MissingCtorResolution missingCtorResolution)
       at ObjCRuntime.Runtime.ConstructNSObject(IntPtr ptr, IntPtr klass, MissingCtorResolution missingCtorResolution)
       at ObjCRuntime.Runtime.GetNSObject(IntPtr ptr, MissingCtorResolution missingCtorResolution, Boolean evenInFinalizerQueue)
       at Registrar.DynamicRegistrar.GetMethodDescriptionAndObject(Type type, IntPtr selector, Boolean is_static, IntPtr obj, IntPtr& mthis, IntPtr desc)
2022-02-02 16:22:34 +01:00
Rolf Bjarne Kvinge 56a71684e5
[CoreImage] Adopt XAMCORE_4_0 changes in .NET. (#13983) 2022-02-02 16:07:45 +01:00
Chris Hamons 0a57125ccc
[tests] Add ILStrip with satellite assemblies lib (#13973)
- Part of investigation of https://github.com/xamarin/xamarin-macios/issues/13922
2022-02-02 09:01:32 -06:00
Rolf Bjarne Kvinge 4b1738826f
[FileProvider] Adopt XAMCORE_4_0 changes in .NET. (#14012) 2022-02-02 08:01:06 +01:00
Rolf Bjarne Kvinge 101c0a7ac0
[Network] Adopt XAMCORE_4_0 changes in .NET. (#13988) 2022-02-01 21:17:18 +01:00
Rolf Bjarne Kvinge 2d48710858
[AppKit] Adopt XAMCORE_4_0 changes in .NET. (#13987)
* A lot of obsolete/deprecated removal.
* Remove the NSDraggingInfo model, which required numerous other changes.
* Remove the NSPasteboardReading/NSPasteboardWriting models, which required more
  numerous changes.
* Update the tests accordingly.
2022-02-01 20:56:32 +01:00
Rolf Bjarne Kvinge b1ce33ba51
[Foundation/ObjCRuntime] Use 'ObjCException' as the native exception type name for all platforms in .NET. Fixes #13855. (#13915)
* Use 'ObjCException' instead of 'MonoTouchException' as the managed exception
  type wrapping an NSException for all platforms in .NET (that was already the
  case for macOS, so no change there).
* Make the ObjCException class behave like the MonoTouchException class does.
* Move the ObjCException type to the ObjCRuntime namespace in .NET.

Fixes https://github.com/xamarin/xamarin-macios/issues/13855.

Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2022-02-01 17:24:57 +01:00
Rolf Bjarne Kvinge 4d2db6463b
[dotnet] Fix templates to use NativeHandle instead of IntPtr. Fixes #13979. (#14001)
Also make the (NativeHandle) constructor protected instead of public, to make
it clearer that it's not for public consumption.

And modify the template tests to execute the template if we can.

Fixes https://github.com/xamarin/xamarin-macios/issues/13979.
2022-02-01 17:22:53 +01:00
Rolf Bjarne Kvinge 5606035493
[MediaAccessibility] Adopt XAMCORE_4_0 changes in .NET. (#13984) 2022-02-01 11:31:45 +01:00
Rolf Bjarne Kvinge aaee4d9f27
[ModelIO] Adopt XAMCORE_4_0 changes in .NET. (#13941)
This turned out a bit complex, because numerous ModelIO APIs were initially bound
with wrong matrix types, and had to be rebound later (our matrix type was transposed
with regards to the native matrix type). The new versions often had to use worse
names, so that's being fixed now. This means that numerous tests had to be updated,
because the original API now returns non-transposed matrices.
2022-02-01 08:08:50 +01:00
Rachel Kang a64b03a886
[CHIP] Updates for Xcode13.2 beta 1 (#13884)
* [CHIP] Updates for Xcode13.2 beta 1

* Update based on feedback

* Update based on feedback and intro test failure

* Update xtro .todo files

* Fix some breaking API changes

* Delete silly typos
2022-01-31 18:55:49 -05:00
Rolf Bjarne Kvinge 7517d6a8b5
[WKWebKit] Adopt XAMCORE_4_0 changes in .NET. (#13992) 2022-01-31 23:47:45 +01:00
Rolf Bjarne Kvinge bd5c7b331f
[Contacts] Adopt XAMCORE_4_0 changes in .NET. (#13993) 2022-01-31 23:46:11 +01:00
Rolf Bjarne Kvinge 1d8ef73ee1
[SystemConfiguration] Adopt XAMCORE_4_0 changes in .NET. (#13991) 2022-01-31 21:54:37 +01:00
Rolf Bjarne Kvinge 2de903f337
[Social] Adopt XAMCORE_4_0 changes in .NET. (#13986)
Also clean up the code to use fewer ifdefs.
2022-01-31 21:33:53 +01:00
Rolf Bjarne Kvinge d1989b63c4
[tests] Simplify makefiles by using shared code. (#13990) 2022-01-31 21:11:08 +01:00
Chris Hamons e8663ebbc7
[NET 6 Attribute Conversion] CoreFoundation (#13816) 2022-01-31 13:27:23 -06:00
Rolf Bjarne Kvinge 6674e83bec
[GameplayKit] Adopt XAMCORE_4_0 changes in .NET. (#13972) 2022-01-31 17:51:08 +01:00
Rolf Bjarne Kvinge 8405fcf3b8
[EventKit] Adopt XAMCORE_4_0 changes in .NET. (#13971) 2022-01-31 17:50:09 +01:00
Rolf Bjarne Kvinge ee8869a9d1
[GameKit] Adopt XAMCORE_4_0 changes in .NET. (#13964) 2022-01-31 17:04:23 +01:00
Rolf Bjarne Kvinge d8c2e5e040
[HealthKit] Adopt XAMCORE_4_0 changes in .NET. (#13968) 2022-01-31 16:57:26 +01:00
Rolf Bjarne Kvinge 62b3eab06d
[Darwin] Adopt XAMCORE_4_0 changes in .NET. (#13965) 2022-01-31 16:51:12 +01:00
Rolf Bjarne Kvinge e64a0b489a
[AVKit] Adopt XAMCORE_4_0 changes in .NET. (#13933) 2022-01-28 18:10:19 +01:00
Rolf Bjarne Kvinge ba555b2fcc
[tests] Use the local .NET for running unit tests. (#13836)
This hopefully solves a few problems on M1, where we'd want to execute with
.NET 5 (last stable .NET release), but that version only supports x86_64, and
then if an ARM64 version of .NET 6 was also installed, things would break in
mysterious ways.

This way we have full control over what happens, and also a consistent
environment across all machines.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-01-28 16:29:37 +01:00
Rolf Bjarne Kvinge b0f84a44c1
[CoreMedia] Adopt XAMCORE_4_0 changes in .NET. (#13932) 2022-01-28 10:20:51 +01:00
Rolf Bjarne Kvinge 43d74fb895
[ObjCRuntime] Add explicit conversion operators between NativeHandle and void*. Fixes #13867. (#13929)
Fixes https://github.com/xamarin/xamarin-macios/issues/13867.
2022-01-28 10:03:54 +01:00
Rolf Bjarne Kvinge d2ef29739b
[CoreAnimation] Adopt XAMCORE_4_0 changes in .NET. (#13918)
* Mostly just removal of obsolete/deprecated API.
* Modified CAScrollLayer.ScrollMode to use the good name
  (CAScrollLayer.ScrollMode) for the strongly typed enum, and then have a
  WeakScrollMode property for the NSString version (like we do elsewhere).
2022-01-28 10:02:46 +01:00
Rolf Bjarne Kvinge fb6ab21bc8
[AppKit] Improve a few API names for .NET. (#13824) 2022-01-27 10:56:06 +01:00
Rolf Bjarne Kvinge 7e8650a931
[ARKit] Adopt XAMCORE_4_0 changes in .NET. (#13886)
For ARKit this just means removing obsolete/deprecated API.
2022-01-27 10:45:50 +01:00
Rolf Bjarne Kvinge 00647d50a5
[ModelIO] Fix the MDLVoxelIndexExtent name for .NET. (#13893) 2022-01-27 10:37:51 +01:00
Chris Hamons 02644cac41
[NET 6 Attribute Conversion] AddressBook (#13715) 2022-01-25 12:57:44 -06:00
Chris Hamons 6ce1ff7093
[NET6] Add binding project template for iOS and MacCatalyst (#13840)
- Fixes https://github.com/xamarin/xamarin-macios/issues/13578
- Uses older-style namespace with {} instead of top level due to https://github.com/xamarin/xamarin-macios/issues/13837
2022-01-25 10:05:56 -06:00
Rolf Bjarne Kvinge e7024da461
[Photos] Adopt XAMCORE_4_0 changes in .NET. (#13830)
This means removing obsolete/deprecated API.

Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2022-01-25 11:58:48 +01:00
Rolf Bjarne Kvinge efb0ac2ac7
[PassKit] Adopt XAMCORE_4_0 changes in .NET. (#13833) 2022-01-25 11:52:59 +01:00
Rolf Bjarne Kvinge fbd55af78b
[NetworkExtension] Adopt XAMCORE_4_0 changes in .NET. (#13842) 2022-01-25 11:50:35 +01:00
Rolf Bjarne Kvinge f83e1cb4b7
[QuickLook] Adopt XAMCORE_4_0 changes in .NET. (#13826) 2022-01-25 11:24:09 +01:00
Sebastien Pouliot eb3015b388
[mobilecoreservices] Modernize UTType (#13831)
* Use `is` instead of `==` for null checks
* Use `ThrowHelper` to throw common exceptions
* Use faster `CFString` API (over the slower `NSString` variants)

* [tests] Adjust UTTypeTest.cs to build for net profile
2022-01-24 21:57:28 -05:00
Rolf Bjarne Kvinge c738fd47b4
[AudioComponentDescription] Strong-type the ComponentSubType field in .NET. (#13827)
Strong names are always better!
2022-01-21 21:30:55 +01:00
Rolf Bjarne Kvinge b540e1f2b9
[UIKit] Adopt XAMCORE_4_0 changes in .NET. (#13820)
This mostly involves removing obsolete/deprecated API.
2022-01-21 17:43:50 +01:00
Sebastien Pouliot 25fab0b74e
[net][coregraphics] Match native strings representation for structs (#13802)
* Use the native `NSStringFrom*` API so we can, eventually, use the
native code to parse them from `NSString` and also ensure increased
compatibility with any code that expects the native string representation

* Add unit tests for `ToString` methods

Also use [`System.HashCode`](https://docs.microsoft.com/en-us/dotnet/api/system.hashcode?view=net-6.0) to generate the hash code
2022-01-21 08:46:25 +01:00
dotnet-maestro[bot] 6a59b3eedd
[main] Update dependencies from dotnet/runtime (#13771)
* Update dependencies from https://github.com/dotnet/runtime build 20220117.8

Microsoft.NETCore.App.Ref
 From Version 6.0.2-mauipre.1.22054.8 -> To Version 6.0.2-mauipre.1.22067.8

* [tests] Adjust according to BCL changes.

* Update dependencies from https://github.com/dotnet/runtime build 20220118.10

Microsoft.NETCore.App.Ref
 From Version 6.0.2-mauipre.1.22054.8 -> To Version 6.0.2-mauipre.1.22068.10

* Update dependencies from https://github.com/dotnet/runtime build 20220119.5

Microsoft.NETCore.App.Ref
 From Version 6.0.2-mauipre.1.22054.8 -> To Version 6.0.2-mauipre.1.22069.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-01-21 08:40:37 +01:00
Rolf Bjarne Kvinge e51355f657
[SceneKit] Adopt XAMCORE_4_0 changes in .NET. (#13806)
This means removing obsolete/deprecated methods.
2022-01-21 08:09:57 +01:00
Rolf Bjarne Kvinge a2f7407b76
[SafariServices] Adopt XAMCORE_4_0 changes in .NET. (#13801) 2022-01-20 10:33:42 +01:00
Rolf Bjarne Kvinge 82a3b71c60
[Foundation] Adopt a better name/signature for numerous Foundation API in .NET. (#13776) 2022-01-20 10:32:55 +01:00
Rolf Bjarne Kvinge 28df7033f2
[MessageUI] Fix enum sizes in .NET. (#13799) 2022-01-20 10:31:59 +01:00
Rolf Bjarne Kvinge 4068c49e8c
[CoreText] Adopt XAMCORE_4_0 changes in .NET. (#13789) 2022-01-20 07:45:32 +01:00
Marius Ungureanu d2ccca6539
Add NullAllowed to NSRunningApplication (#13703) 2022-01-19 22:36:07 +01:00
Rolf Bjarne Kvinge 26d9d9172a
[ScriptingBridge] Improve API and add nullability. (#13787)
* Improve the API for both legacy Xamarin and .NET.
* Obsolete the old API in legacy Xamarin and point to the new API.
* Remove the old API in .NET.
* Add nullability.
2022-01-19 20:52:18 +01:00
Rolf Bjarne Kvinge c6ee74377a
[msbuild] Unify some of the codesign dependency properties. (#13725) 2022-01-19 18:54:08 +01:00
Rolf Bjarne Kvinge 9368e0871e
[VideoSubscriberAccount] Adopt XAMCORE_4_0 changes in .NET. (#13778) 2022-01-19 18:51:26 +01:00
Rolf Bjarne Kvinge d7f1829a4b
[StoreKit] Adopt XAMCORE_4_0 changes in .NET. (#13783)
This is mostly removing obsolete/removed API, except for
SKProduct.ContentVersion, where the XAMCORE_4_0 annotations were wrong and the
property is still alive and kicking.
2022-01-19 18:50:30 +01:00
Rolf Bjarne Kvinge a914a8b23d
[SpriteKit] Adopt XAMCORE_4_0 changes in .NET. (#13786)
This means removing numerous obsolete/deprecated methods where better/more
correct alternatives already exist.

Also fix one obsolete message and adjust the tests.
2022-01-19 18:49:47 +01:00
Rolf Bjarne Kvinge 697e5b330e
[src] Fix optional/required protocol members in .NET. (#13764)
Make required protocol members [Abstract] and optional protocol members not in
.NET. This way we're matching Apple's API (for now at least).
2022-01-19 09:03:35 +01:00
Rolf Bjarne Kvinge 1c4c297795
[AppKit] Update NSSpellingState to be a native enum in .NET, according to current AppKit headers. (#13770) 2022-01-19 08:29:08 +01:00
Sebastien Pouliot 0d95c4a5b9
[net][objcruntime] Add `GetHashCode` and `Equals` to `DisposableObject` (#13746)
* Ensure all `DisposableObject` subclasses have an implementation based
  on their `Handle` property and not relying on `System.Object` default.
  E.g. `CFArray`, `CFString`...

* Reduce code duplication for the few subclasses that have overrides
  doing just the same, e.g. `Class`, `Selector`

Types subclassing `NativeObject` that had `Equals` and `GetHashCode` overridden

* CoreFoundation.CFRunLoop
* CoreFoundation.DispatchObject (and DispatchQueue subclass)
* CoreGraphics.CGColor -> special case with it's own [native equality function](https://developer.apple.com/documentation/coregraphics/1455217-cgcolorequaltocolor) [1]
* CoreGraphics.CGPath -> special case with it's own [native equality function](https://developer.apple.com/documentation/coregraphics/1411167-cgpathequaltopath) [1]
* Security.SecPolicy

[1] this is a **BUG** since `Equals` can return `true` while `GetHashCode` returns different values !?!?!

> Two objects that are equal return hash codes that are equal.
https://docs.microsoft.com/en-us/dotnet/api/system.object.gethashcode?view=net-6.0

I'm not sure how to get a good _fast_ hash code...

> However, the reverse is not true: equal hash codes do not imply object equality, because different (unequal) objects can have identical hash codes.

but returning a constant if fast and valid - even if it looks funky.

Subclasses that did not have `Equals` and `GetHashCode` implemented

* VideoToolbox.VTFrameSilo
* VideoToolbox.VTMultiPassStorage
* VideoToolbox.VTSession
* SystemConfiguration.NetworkReachability
* Security.SecCertificate
* Security.SecIdentity
* Security.SecKey
* Security.SecAccessControl
* Security.SecCertificate2
* Security.SecIdentity2
* Security.SecProtocolMetadata
* Security.SecProtocolOptions
* Security.SecTrust
* Security.SecTrust2
* Security.SslContext
* Network.NWAdvertiseDescriptor
* Network.NWBrowseResult
* Network.NWBrowser
* Network.NWBrowserDescriptor
* Network.NWConnection
* Network.NWConnectionGroup
* Network.NWContentContext
* Network.NWDataTransferReport
* Network.NWEndpoint
* Network.NWError
* Network.NWEstablishmentReport
* Network.NWFramer
* Network.NWInterface
* Network.NWListener
* Network.NWMulticastGroup
* Network.NWParameters
* Network.NWPath
* Network.NWPathMonitor
* Network.NWPrivacyContext
* Network.NWProtocolDefinition
* Network.NWProtocolMetadata
* Network.NWProtocolOptions
* Network.NWProtocolStack
* Network.NWResolutionReport
* Network.NWResolverConfig
* Network.NWTxtRecord
* Network.NWWebSocketRequest
* Network.NWWebSocketResponse
* MediaToolbox.MTAudioProcessingTap
* ImageIO.CGImageDestination
* ImageIO.CGImageMetadata
* ImageIO.CGImageMetadataTag
* ImageIO.CGImageSource
* CoreVideo.CVBuffer
* CoreVideo.CVMetalTexture
* CoreVideo.CVMetalTextureCache
* CoreVideo.CVPixelBufferPool
* CoreText.CTFont
* CoreText.CTFontCollection
* CoreText.CTFontDescriptor
* CoreText.CTFrame
* CoreText.CTFramesetter
* CoreText.CTGlyphInfo
* CoreText.CTLine
* CoreText.CTParagraphStyle
* CoreText.CTRun
* CoreText.CTRunDelegate
* CoreText.CTTextTab
* CoreText.CTTypesetter
* CoreMedia.CMBlockBuffer
* CoreMedia.CMBufferQueue
* CoreMedia.CMFormatDescription
* CoreMedia.CMMemoryPool
* CoreMedia.CMSampleBuffer
* CoreMedia.CMClockOrTimebase
* CoreGraphics.CGColorConversionInfo
* CoreGraphics.CGColorConverter
* CoreGraphics.CGColorSpace
* CoreGraphics.CGContext
* CoreGraphics.CGDataConsumer
* CoreGraphics.CGDataProvider
* CoreGraphics.CGFont
* CoreGraphics.CGFunction
* CoreGraphics.CGGradient
* CoreGraphics.CGImage
* CoreGraphics.CGLayer
* CoreGraphics.CGPDFContentStream
* CoreGraphics.CGPDFDocument
* CoreGraphics.CGPDFOperatorTable
* CoreGraphics.CGPDFPage
* CoreGraphics.CGPDFScanner
* CoreGraphics.CGPattern
* CoreGraphics.CGShading
* CoreFoundation.CFBundle
* CoreFoundation.CFAllocator
* CoreFoundation.CFArray
* CoreFoundation.CFBoolean
* CoreFoundation.CFData
* CoreFoundation.CFDictionary
* CoreFoundation.CFMachPort
* CoreFoundation.CFMessagePort
* CoreFoundation.CFNotificationCenter
* CoreFoundation.CFPropertyList
* CoreFoundation.CFRunLoopSource
* CoreFoundation.CFString
* CoreFoundation.CFType
* CoreFoundation.CFUrl
* CoreFoundation.DispatchBlock
* CoreFoundation.OSLog
* CoreServices.CFHost
* AddressBook.ABAddressBook
* AddressBook.ABMultiValue<T>
* AddressBook.ABRecord
* ObjCRuntime.BaseWrapper
2022-01-19 08:22:24 +01:00
Rolf Bjarne Kvinge fa2173e5ef
[CFNetwork] Move the CFHost and CFHTTP* types to the CFNetwork namespace in .NET. (#13761)
These types come from the CFNetwork.framework, but for some reason they were bound inside CoreServices many years ago.

This resolves a potential issue where we might end up linking with the
CoreServices framework instead of CFNetwork framework (because we use the
namespace of types to determine which framework they belong to).
2022-01-19 08:07:06 +01:00
Rolf Bjarne Kvinge d49903ccca
[AppKit] Fix atrocious API naming in NSTextFinderClient in .NET. (#13769) 2022-01-18 20:23:09 +01:00
Chris Hamons a9c2caa571
[tests] Disable attribute duplication check (#13745)
- Disable check "[FAIL] Both '{t}' and '{m}' are marked with `{s}`." type and member on that type in NET
- Due to the behavior of NET6 style attributes, we are forced to duplicate availability attributes in many cases
- See https://github.com/xamarin/xamarin-macios/issues/10170 for details
2022-01-18 09:07:43 -06:00
Rolf Bjarne Kvinge c3e5d7e575
[tests] Ignore more cases of 502 errors in our tests. (#13768) 2022-01-18 15:53:37 +01:00
Rolf Bjarne Kvinge e8c55ddac0
[Foundation] Remove compat overloads of methods taking a NSUrlSessionPendingTasks delegate in .NET. (#13759) 2022-01-18 11:13:29 +01:00
Rolf Bjarne Kvinge f831146acf
[introspection] Add exception according to recent changes in .NET API. (#13762) 2022-01-18 11:05:58 +01:00
Rolf Bjarne Kvinge 14824b92b2
[tests] Simplify mmptest a bit by using existing mechanisms to create frameworks. (#13757) 2022-01-18 11:05:41 +01:00
Rolf Bjarne Kvinge 391b46b14f
[Foundation] Make NSBundleExecutableArchitecture non-native. (#13754)
NSBundleExecutableArchitecture is an enum of our own invention, so there's no
need for it to be a native enum.
2022-01-18 10:52:15 +01:00
Rolf Bjarne Kvinge f5cf33858b
[Foundation] Fix the NSMetadataItem.UbiquitousItemDownloadingStatus property name for .NET. (#13753) 2022-01-18 10:51:34 +01:00
Rolf Bjarne Kvinge 04a77c56dc
[Foundation] Fix a few method names to follow naming guidelines for .NET. (#13763) 2022-01-18 10:39:04 +01:00
Rolf Bjarne Kvinge 7b9f938f65
[Intents] Remove INSetMessageAttributeIntentResponseCode from macOS in .NET. (#13752)
According to the headers it's not available in macOS.
2022-01-18 08:09:49 +01:00
Rolf Bjarne Kvinge 5dd0b0dd62
[Intents] The INPersonRelationship enum was added to macOS 12.1 according to the documentation. (#13751)
But only some values, the rest aren't available, so remove those from .NET.
2022-01-18 08:06:54 +01:00
Rolf Bjarne Kvinge 97dcd69d41
[Foundation] Remove some obsolete API in .NET. (#13678) 2022-01-17 20:58:46 +01:00
Rolf Bjarne Kvinge 7ab734068c
[AudioUnit] Improve a few AudioUnit methods to return the error code. (#13730)
This makes it easier to figure out problems in consuming code, since it makes
it easier to identify where things start to go wrong.

Fixes https://github.com/xamarin/maccore/issues/2539.
2022-01-17 17:02:43 +01:00
Rolf Bjarne Kvinge 1d9a02cbef
[dotnet] Figure out where to publish files in the app bundle. Fixes #12572. (#13591)
In .NET, all files that should be published (put into the final .app bundle) are put into the @(ResolvedFileToPublish) item group, and at the end of the build process, .NET will publish all the files in that item group. Which files are in this item group, and how they're put in there, is out of our control (it's just how the build process works in .NET), so we'll have to cope.

Additionally, publishing an app for Apple platforms is different than publishing other .NET apps, because we can't just put all the files in the a directory like .NET usually does, we have a fairly strict directory structure we need to follow, and it also differs between platforms (the structure is different between macOS and iOS for instance).

This means that for every file in the `ResolvedFileToPublish` item group, we have to figure out:

* Should it be put into the app bundle in the first place?
* If so, in which subdirectory (if any)?

This PR implements these changes. The exact details are explained in a document in the PR, but the general logic is:

* We make an educated guess for some types of files we know about (assemblies, unmanaged libraries, images, etc).
* We provide a way to set metadata on each item specifying which type of item it is (assembly, unmanaged library, image, etc), and we'll treat the item as such. This method can also be used to override the guess we made (for files that shouldn't be published for instance).
* We warn if we run into files we're not educated enough to be able to guess about, and for which there's no custom metadata set.

Fixes https://github.com/xamarin/xamarin-macios/issues/12572.
2022-01-17 09:50:06 +01:00
Rolf Bjarne Kvinge ce86f7746b
[Foundation] Remove some obsolete NSObject API in .NET (#13719)
Remove badly named API (or with typos) in .NET.
2022-01-17 09:45:44 +01:00
Rolf Bjarne Kvinge 3183517e9d
[AppKit] Rename NSTableView.DragImageForRowsWithIndexestableColumnseventoffset to NSTableView.DragImageForRows in .NET. (#13723)
The original name is quite bad.
2022-01-17 09:45:03 +01:00
Rolf Bjarne Kvinge 0f5642f4b5
[Intents] Remove Intents types from macOS in .NET that were added by mistake. (#13727)
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2022-01-17 09:40:29 +01:00
Rolf Bjarne Kvinge f219bc0851
[Foundation] Remove a few broken NSExpression overloads in .NET. (#13728) 2022-01-17 09:38:16 +01:00
Rolf Bjarne Kvinge ed02a212bf
[Foundation] Replace broken version of NSRegularExpression.GetMatches with a working version for .NET. (#13732) 2022-01-17 09:34:26 +01:00
Rolf Bjarne Kvinge 209eca1fb7
[CGAffineTransform] Rename public fields in .NET to follow Apple and managed naming conventions. Fixes #13494. (#13737)
Rename the public fields in CGAffineTransform to:

* Follow our naming convention (public API should always start with an
  upper-case letter).
* Use the same names as Apple's version to ease porting Swift/Objective-C
  code.

Fixes https://github.com/xamarin/xamarin-macios/issues/13494.
2022-01-17 09:26:39 +01:00
Rolf Bjarne Kvinge ccf651c5f3
[Intents] Fix optional/abstract for protocols in .NET. (#13738) 2022-01-17 09:22:43 +01:00
Rolf Bjarne Kvinge ce609e5153
[Foundation] Abstractify protocol members in .NET. (#13741) 2022-01-17 09:20:58 +01:00
Rolf Bjarne Kvinge e963fc6f5f
[CoreData] Move CoreData into the .NET age. (#13718)
* Remove obsolete API from .NET.
* Change API marked with XAMCORE_4_0 due to naming problems to be in .NET.
* Change API marked with XAMCORE_4_0 due to using non-generic NSDictionary to be
  in XAMCORE_5_0 instead (yay!). This is because of #13704, which can make using
  generic NSDictionary in API buggy, and I feel it's a bit too risky to change this
  for .NET with the time we have available (no time to fix #13704). Additionally,
  moving this to XAMCORE_5_0 makes it possible to keep grepping for XAMCORE_4_0 to
  see what's left. Update all the CoreData API to be better as defined by our XAMCORE_4_0
  define. Mostly using generic NSSet/NSDictionary types instead of the non-generic
  ones, and other misc naming improvements.
* Change API marked with XAMCORE_4_0 due to both of the above to do both of the
  above - add a version of the naming issue fixed for .NET + a version with the generic
  dictionary for XAMCORE_5_0.
2022-01-14 17:13:46 +01:00
Rolf Bjarne Kvinge a34ca54cc2
[src] Make sure the (IntPtr/NativeHandle, bool) ctor is always preserved (conditionally) for types that subclass NativeObject. Fixes #13699. (#13708)
Also add test to make sure we never forget again.

Fixes https://github.com/xamarin/xamarin-macios/issues/13699.
2022-01-14 15:26:23 +01:00
Rolf Bjarne Kvinge 6564841c6a Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-14 11:00:16 +01:00
Rolf Bjarne Kvinge 5ef6fac236 [xharness] Give the .NET tests another hour to complete. 2022-01-14 10:58:33 +01:00
Rolf Bjarne Kvinge 9894605c4f
[SceneKit] Make SCNMatrix4 column-major in .NET. Fixes #4652. (#13695)
* Implement a column-major version of SCNMatrix4 in .NET to match native code.
* This was done by copying the existing SCMatrix4 implementation, and modify it
  as required (doing it with conditional compilation in the same file turned out
  to be quite messy, so I opted for using different files for legacy Xamarin and
  .NET).
* There was one major change: the matrix inversion algorithm is new (copied from
   .NET instead), because the legacy Xamarin version showed strange results with
  some test values.
* Add setters for SCNMatrix4.Column[0-3] for legacy Xamarin to match the .NET API.
* Add CreateFromColumns methods for legacy Xamarin to match the .NET API.
* Add tests for all the new API.

Fixes https://github.com/xamarin/xamarin-macios/issues/4652.
2022-01-14 07:30:19 +01:00
Rolf Bjarne Kvinge 1ee7a63412
[Foundation] Remove the NSDateComponentsWrappingBehavior in .NET. (#13713)
It's our own enum, and all the API using it have been obsoleted/removed.

There doesn't seem to be any other usage of it on GitHub either (only our own
source code and documentation).
2022-01-14 07:27:08 +01:00
Rolf Bjarne Kvinge 76cd53fe4d
[Foundation] Rename the NSLinguisticTagUnit enum to NSLinguisticTag in .NET. (#13706) 2022-01-13 22:30:44 +01:00
Rolf Bjarne Kvinge 65a7794244
[AppKit] Update NSWindowStyle deprecations according to headers. (#13696)
Also remove the Unscaled field, it's removed from the headers, and it was
deprecated before the earliest macOS version we support.

Also also fix a few xtro issues.
2022-01-13 22:29:11 +01:00
Rolf Bjarne Kvinge a2e4438536 Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-13 22:13:00 +01:00
Rolf Bjarne Kvinge d953b6f037 [tests] Augment tests to rebuild and make sure the result is as expected. 2022-01-13 22:07:57 +01:00
Sebastien Pouliot f269d03c06
[coregraphics] Fix some names for the NET profile (#13668)
* Fix `CGColorConversionInfoTriple` name (missing initial `C`)

* Rename `RectangleFExtensions` to `CGRectExtensions` since the former
  name has not been around for a while

* Remove API naming mistakes (already under XAMCORE_4_0)

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-01-13 07:18:39 +01:00
Rolf Bjarne Kvinge a35ee4e7a6
[CoreAnimation] Rename CATransform3D's fields to follow standard naming conventions for .NET. (#13684)
Public fields shouldn't start with a lower-cased letter.

Also provide public properties in legacy Xamarin so that we can write
identical code for both, and obsolete the lower-cased fields.
2022-01-12 21:46:20 +01:00
Rolf Bjarne Kvinge 10ad084ec3
[AudioUnit] Create a GCHandle when AudioUnit.SetInputCallback is called. Fixes #13637. (#13673)
AudioUnit needs a GCHandle in the input callback, which means we have to create it
when SetInputCallback is called (like we already do for SetRenderCallback).

Fixes https://github.com/xamarin/xamarin-macios/issues/13637.
2022-01-12 20:52:03 +01:00
Rolf Bjarne Kvinge 131829c4c4
[xharness] Bump timeout for the .NET tests to 3 hours. Fixes #xamarin/maccore@2538. (#13685)
Fixes https://github.com/xamarin/maccore/issues/2538.
2022-01-12 20:26:24 +01:00
Rachel Kang 304048a965
Add cecil test for verifying obsoleted apis (#13590)
* First version cecil test

* Add missing net6 platform assemblies

* Make it work for Catalyst

* Add namespace switch and clean up code

* Update based on feedback

* Update based on feedback

* Update based on feedback

* Make test pass by default

* Fix bgen tests by fixing GetRefNuGetName

* Update based on feedback

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2022-01-12 09:47:46 -05:00
Rolf Bjarne Kvinge 6f1362f1d2
[tests] Add helpful makefiles for a few test suites. (#13677)
Add makefiles that can build a test for all platforms with a single rule.
2022-01-12 11:39:06 +01:00
Rolf Bjarne Kvinge 753b3ee100 [tests] Simplify makefiles by deleting unused targets. 2022-01-11 17:35:20 +01:00
Rolf Bjarne Kvinge 214064d430 Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-11 17:32:26 +01:00
Rolf Bjarne Kvinge 16358a7963
[ObjCRuntime] Fix the DisposableObject.Owns property to return the correct value. Fixes #13646. (#13666)
* [ObjCRuntime] Fix the DisposableObject.Owns property to return the correct value. Fixes #13646.

Ops...

Also add tests to avoid more oopses.

Fixes https://github.com/xamarin/xamarin-macios/issues/13646.

* Update tests/monotouch-test/AudioToolbox/AudioConverterTest.cs

Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2022-01-11 15:37:31 +01:00
Manuel de la Pena 94863148dc
[CI] Fix device tests (#13657)
Allow device tests to run. Tests do not pass yet, that has to be fixed in xharness.
2022-01-10 11:48:34 -05:00
TJ Lambert a0ad207ea7
[Dotnet] Automatically Allow Assets of all types and Test (#13346) 2022-01-10 08:32:05 -06:00
Rolf Bjarne Kvinge e06151c903
[VideoToolbox] Add a VTCompressionSession.EncodeFrame overload that takes a CVImageBuffer instead of a handle to one. (#13631)
This makes the API nicer to use.
2022-01-10 13:00:34 +01:00
Alex Soto dfe6c2b5ab
[main] Add Xcode 13.2 Support (#13643)
* [Xcode13.2] Bump to Xcode 13.2 RC (#13497)

* [Xcode13.2] Bump to Xcode 13.2 Beta 2

Breaking changes addressed for legacy
* HomeKit
* CallKit
* CoreLocation

* [xcode13.2] Bump to Xcode 13.2 RC and apply feedback

* [AppKit] Fix missing Notifications

* Fix xtro

* [xcode13.2] Bump versions and use stable Xcode 13.2

* [monotouch-tests] Make TestAddingByComponents work on the last day of the year

Happy New Year!!

* NO BOM PLZ!
2022-01-03 09:28:00 -05:00
Rolf Bjarne Kvinge 05ca39b211 [xharness] Bump timeout for .NET tests to 3 hours. 2021-12-22 21:50:33 +01:00
Rolf Bjarne Kvinge 5a45a3c3aa
[src] Remove the ModelAttribute.AutoGeneratedName property in .NET. (#13619)
AutoGeneratedName was a toggle to implement a certain (correct) behavior,
while at the same time not cause breaking changes.

Now that we can do breaking changes in .NET, we can remove the toggle (i.e.
the property), and just always do the right thing (that is: automatically
generate a _unique_ Objective-C name for Model classes, unless a name is
specified manually).

Ref: https://github.com/xamarin/xamarin-macios/issues/5107
2021-12-22 21:28:19 +01:00
Rolf Bjarne Kvinge ecbeca5725 [tests] Adjust the IsNotMacBuild .NET test to not expect Xamarin.iOS.dll in the app bundle.
We're copying files differently to the bundle now, and we end up doing less
when not building on a Mac, which is why we're not copying Xamarin.iOS.dll
anymore.
2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 268620bd0e [tests] Add BundleStructure, a test project to verify how files end up in the app bundle. 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 5a2a7eef4f [tests] Make bindings-framework-test a NoBindingEmbedding binding project.
NoBindingEmbedding is the future, and that's what we want to test as well.
2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 20c41e1dc6 [tests] Print the binlog path on a line all by itself.
I look at the binlog *all the time*, and this shaves off a few seconds every time
I have to find the path to it.
2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 0681dc1f4a [tests] Move some sharable code to a more generic location, so that it's easier to share 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 7774518079 [tests] Allow for more time to build tests/test-libraries now, since more work is being done there 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge d430dd74c0 [tests] Add build logic to build numerous native libraries for testing purposes. 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 0cc54bd76e [tests] Add build logic to build NuGets for testing purposes. 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 40d4e6a49a [tests] Add build logic to build numerous native plugins for testing purposes. 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge cf290be186 [tests] Add build logic to build numerous native frameworks for testing purposes. 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 1a5e397b01 [tests] Add a zipped version of XTest.[xc]framework 2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge 1c008fe315 [tests] Fix some make logic in test-libraries.
Use the right template variable in the template expansion to avoid duplicating variable names.
2021-12-22 10:17:33 +01:00
Rolf Bjarne Kvinge b75b9f509a
[UIKit] Make UITextInputTraits members optional in .NET. Fixes #5831. (#13607)
Once upon a long time ago we decided to mark the properties in the
UITextInputTraits protocol as required in our API definition, because that way
we'd inline these properties in any class that implemented the
UITextInputTraits protocol, which made calling these properties much easier.

At a later point, we implemented better support for protocols, and now we
automatically generate extension methods for such properties (a corresponding
Get/Set method for the get/set property accessors), so we don't need these
inlined properties anymore.

However, removing them would be a breaking change, so we were stuck with these
redundant inlined properties, until .NET came along.

Ref: 0e80570863

Fixes https://github.com/xamarin/xamarin-macios/issues/5831.
2021-12-22 08:01:15 +01:00
Rolf Bjarne Kvinge c45d0ae55c
[generator] Fix the selector in extension methods for protocol properties with Bind attributes. Fixes #12727. (#13618)
Take into account any Bind attributes on optional property getters and setters
on protocols when generating the Get* and Set* extension methods, so that we
use the right selector.

Fixes https://github.com/xamarin/xamarin-macios/issues/12727.
2021-12-21 20:39:03 +01:00
Rolf Bjarne Kvinge f87016ca7d
[tests] Allow 502 Bad Gateway as well in the SecureTransportTest.Tls12 test. (#13610)
The "502 Bad Gateway" error occurs sometimes on the bots.

Maybe we should rename it "502 Bad Bot"?
2021-12-21 15:23:15 +01:00
Rolf Bjarne Kvinge b695c8c837
[dotnet] Don't add FileNativeReferences to the main libraries to link with. Fixes #13503. (#13598)
Don't add FileNativeReferences to the main libraries to link with, because we
pass that list of main libraries to the LinkNativeCodeTask, and we're already
passing the FileNativeReferences for a different task parameter.

This means that we end up adding the file native reference twice to the linker
arguments, and that's wasteful. It can also cause problems if those linker
arguments aren't always computed in the same way (once as a relative path,
once as an absolute path for instance).

Fixes https://github.com/xamarin/xamarin-macios/issues/13503.
2021-12-21 08:13:53 +01:00
Rolf Bjarne Kvinge 1100703536
[AVFoundation] Address all the XAMCORE_4_0 notes in AVFoundation for .NET. (#13593) 2021-12-21 08:12:25 +01:00
Rolf Bjarne Kvinge 368cf1fbbb
[VTCompressionSession] Fix broken Create overloads for .NET. (#13589)
Once upon a time there was a single VTCompressionSession.Create method, which
was [driving users insane][1] - they had to manually call CFRetain to avoid
crashes! What an abomination!!

Insane users are clearly not happy users, and we wanted happy users, so time
and effort went into creating a solution: a new Create overload was devised
and [implemented][1], taking extreme care to not break our brave and insane
existing users who had to manually call CFRetain. Because the fix would break
existing users - the now extraneous CFRetain would mean that their apps would
leak memory. *A lot* of it! That's bad, so we decided to make sure that didn't
happen.

Of course, dear old Murhpy wanted a say, so the new Create overload didn't do
as intended. In fact, it had the same insane behavior the old Create overload
had! Ops.

But Murphy decided to have even more fun: the changes were so buggy, that they
in fact fixed the old Create overload! Which from now on wouldn't require the
horrendous manual CFRetain calls... and effectively introducing the leak the
fix was trying so hard to not introduce.

Oh dear Murphy.

Of course he had another trick up his sleeve: in our extreme efforts to help
our users, we added an Obsolete attribute that would tell people to use the
new Create overload.

Let that sink in for a moment: we had an Obsolete attribute on a function that
was (now) perfectly fine, telling users to use a function that was broken.

To get the correct behavior, users would now have to to remove their manual
CFRetain calls, and ignore the obsolete warning on the old (and correct)
Create overload which told users to use the new (and buggy) Create overload.

In other words: still insanity, just a slightly different flavor.

Murphy had a field day!

Time went by, and eventually a sane enough user [reported the insanity to
us][2]. Even better: the user actually provided a fix! Truly, we have some
amazing users.

Unfortunately, the user didn't have access to our code history, and thus was
obviously not able to see the whole picture, and the fix ended up being
incorrect.

Unrelated lesson learned: don't forget your history, otherwise you'll end up
repeating mistakes from the past.

So now came the problem: how to fix all the APIs? In a way that didn't make
our users' existing apps just suddenly start crashing or leaking?

There really was no way, so nothing really happened for quite a while.

Then, an opportunity presented itself: we'd be able to do [widespread breaking
changes][3].

So, hoping that Murphy stays away this sunny winter day, I'm changing both the
new and the old Create overloads to do the right thing. But only in .NET,
where we can do breaking changes! Or at least that's my intention. I've tried
to stave off our dear old friend by adding his arch enemy: unit tests. Which,
of course, Murphy couldn't stay away from, but it seems adding a few
Thread.Sleep calls makes him bored enough to stay away. Hopefully for good...

[1]: 66c50b9a17
[2]: https://github.com/xamarin/xamarin-macios/pull/2070
[3]: https://github.com/xamarin/xamarin-macios/issues/13087
2021-12-21 08:08:40 +01:00
Rolf Bjarne Kvinge 3e0f589cd6
Merge branch 'main' into avfoundation-xamcore40 2021-12-20 18:07:05 +01:00
Rolf Bjarne Kvinge e103cbc6f5
[xharness] Improve how we execute external processes in certain cases (#13596)
* Capture evaluation output, and write it all to the terminal when something
  goes wrong. This way we can see the entire output next to the failure (often
  there's a lot of stuff written to the terminal from different threads, and
  this way we get all that matters written together).
* Only evaluate one project at a time, to avoid overloading the machine.
* Only execute `git ls-files` once at a time, to avoid overloading the machine.
* Bump evaluation timeout to 5 minutes.
* Also increase the time for git to list files in a directory to 60 seconds.

Hopefully this will fix errors like this:

* `Unable to evaluate the property OutputPath, build failed with exit code 0. Timed out: True`
* `System.Exception: Failed to list the files in the directory /Users/builder/azdo/_work/1/s/xamarin-macios/tests/xharness/tmp-test-dir/monotouch-test3403 (TimedOut: True ExitCode: 0)`
2021-12-20 18:05:55 +01:00
Rolf Bjarne Kvinge 07f19ed423
Fix grammar in documentation
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2021-12-20 08:26:08 +01:00
Rolf Bjarne Kvinge 9ee6af7d4d
Fix grammar in documentation
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2021-12-20 08:26:02 +01:00
Rolf Bjarne Kvinge 09f349b8ce
[generator] Fix reporting BI1042. (#13587)
Fix reporting BI1042 to include the type + property that triggered the error +
add a test.
2021-12-17 21:47:24 +01:00
Rolf Bjarne Kvinge aee17ec7ad Update xtro. 2021-12-17 07:45:12 +01:00
Rolf Bjarne Kvinge 6307a3ab84 [AVFoundation] Remove numerous AVMetadataObject fields in .NET
These fields are already available on the AVMetadataObjectType enum, so this removes
some duplication.
2021-12-17 07:45:12 +01:00
Rolf Bjarne Kvinge e3a9095830 [AVFoundation] Remove a few macOS-only structs from non-macOS platforms on .NET. 2021-12-17 07:45:12 +01:00
Rolf Bjarne Kvinge 9a67ae6f36 [AVFoundation] Remove some obsolete API from .NET 2021-12-17 07:45:12 +01:00
Rolf Bjarne Kvinge 02e4d749c3 [AVFoundation] Remove inexistent API from AVPlayerLoop 2021-12-17 07:45:12 +01:00
Rolf Bjarne Kvinge bcbb6c8438
[src] Define XAMCORE_3_0 for .NET for all platforms. (#13566)
Also update xtro and tests accordingly.
2021-12-17 07:44:02 +01:00
Rolf Bjarne Kvinge bc2a5e2251
[xharness] Inline the dotnet-shared.csproj file as well when inlining shared imports. (#13514)
This fixes a problem where we'd build the same project reference from
dotnet-shared.csproj in parallel, and each build would stomp on eachother
(because we'll now clone the project references in dotnet-shared.csproj).

This als required updating project files to use MSBuildThisFileDirectory
instead of MSBuildProjectDirectory, which makes it easier for xharness to
inline/process these files, because MSBuildThisFileDirectory is easy to know
when processing a file, while MSBuildProjectDirectory depends on the calling
project, which complicates matters significantly.

A fix in MonoTouch.Dialog was also required.

New commits in migueldeicaza/MonoTouch.Dialog:

* migueldeicaza/MonoTouch.Dialog@59fbf5b [dotnet] Shared project files don't need the DefaultTargets/ToolsVersion/xmlns attributes.

Diff: 4d0e0a9a5f..59fbf5bb1b

Fixes https://github.com/xamarin/maccore/issues/2527.
2021-12-16 19:01:39 +01:00
Rolf Bjarne Kvinge 32b112bad9
[tests] Shutdown build servers when rebuilding. (#13581)
This makes sure that MSBuild picks up rebuilt task assemblies.
2021-12-16 17:40:12 +01:00
TJ Lambert c4e3ab85c2
[Dotnet] Fix building twice in a row issue (#13573) 2021-12-16 09:07:47 -06:00
Rolf Bjarne Kvinge c6efb26432
[AppKit] Make sure NSFunctionKey doesn't come into Mac Catalyst in .NET. (#13582)
If NSFunctionKey isn't in Mac Catalyst in legacy Xamarin, it shouldn't be in
.NET either, so adjust the conditional logic accordingly.

Also make the NSFunctionKey enum a non-native enum in .NET, like it's in the
headers.
2021-12-16 07:40:58 +01:00
Rolf Bjarne Kvinge b169c806fc
[dotnet] Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst. Fixes #10312. (#13562)
Remove Runtime.Arch and ObjCRuntime.Arch from Mac Catalyst, because they don't
apply for a Mac Catalyst app (which is neither a simulator environment, nor a
device environment).

This means that code using these APIs will have to be re-evaluated to
determine what's the correct behavior for Mac Catalyst.

Also update our tests accordingly.

Fixes https://github.com/xamarin/xamarin-macios/issues/10312.
2021-12-15 22:32:14 +01:00
Rolf Bjarne Kvinge 69015b3cec
[dotnet] Honor 'TrimMode' to specify linker behavior if LinkMode/MtouchLink aren't set. Fixes #13518. (#13543)
* Change dotnet-linker to only care about whether we're actually trimming anything or not.
* Allow LinkMde/MtouchLink to not be set if TrimMode is set.
* Detect if any assemblies are linked or not by checking the global TrimMode
  property + any TrimMode properties on assemblies.

Fixes https://github.com/xamarin/xamarin-macios/issues/13518.
2021-12-15 09:27:00 +01:00
Rolf Bjarne Kvinge 342b312a73
Our current behavior is to detect any None, BundleResource or Content item that's (#13550)
named 'Info.plist', and assume that's the app manifest.

That doesn't quite work when we end up with multiple 'Info.plist' entries in any
of those item groups (one example being a framework as a BundleResource - all frameworks
have an Info.plist, and there's no good way to distinguish what the developer's intention
was).

So:

1. Implement a 'AppManifestDetectionEnabled' property to disable automatic app manifest
   detection.

2. Add a public 'AppBundleManifest' property that specifies the app manifest
   (this is just a renamed version of our previously private '_AppManifest' property).

This makes it possible for app developers to:

* Disable automatic app manifest detection.
* Still have an app manifest by specifying it manually.
* Disable automatic app manifest detection, but also not specify an app manifest
  manually (so no custom app manifest at all).

Also:

* Rename '_AppBundleManifest' to '_AppBundleManifestPath' to make it less confusing
  with the new 'AppBundleManifest' property.
2021-12-14 20:56:52 +01:00
Rolf Bjarne Kvinge bb2572fba5
[tests] Remove workaround for an objc_msgSend bug that's been fixed for a while. (#13556)
We're not executing anywhere where this bug is present anymore.
2021-12-14 17:07:14 +01:00
Rolf Bjarne Kvinge 0bd6cf095c
[tests] Remove a few Assert.Inconclusive calls that won't be executed anymore. (#13557)
Don't conditionally ignore tests that fail on Snow Leopard (or earlier),
because we're always executing on a later OS now.
2021-12-14 17:06:09 +01:00
Rolf Bjarne Kvinge 6fe346e004
[tests] Remove some dead code. (#13558) 2021-12-14 17:05:53 +01:00
Rolf Bjarne Kvinge 61bf0a804b
[tests] Remove a few useless Assert.Inconclusive calls at the end of test methods. (#13559)
There's no reason to call Assert.Inconclusive at the end up a test method,
because we won't get that far in the test method if it fails.
2021-12-14 17:05:18 +01:00
Rolf Bjarne Kvinge ed1c769017
[tests] Remove dead code from test that's already ignored (#13555) 2021-12-14 17:04:17 +01:00
Rolf Bjarne Kvinge a93d76304e
[src] Modify some logic for Mac Catalyst that tests the current runtime architecture (Runtime.Arch) to behave like macOS instead (which doesn't check Runtime.Arch). (#13536) 2021-12-14 08:26:14 +01:00
Rolf Bjarne Kvinge d0f33c7931
[msbuild] Fix merging of apps with symlinks to directories. (#13546)
Symlinks to directories are treated the same as other symlinks (as files), not
as directories. This way we don't end up re-creating a directory hierarchy
when we only have to create a symlink.
2021-12-14 08:10:23 +01:00
Rolf Bjarne Kvinge c93cd3a99c
[Metal] Usher the Metal API into the golden age of .NET. (#13533)
* Change all XAMCORE_4_0 conditions to NET conditions.
* Add numerous Release attributes that xtro started complaining about.
* Misc other minor API changes/updates.
2021-12-13 20:40:29 +01:00
Rolf Bjarne Kvinge aa3a17dfc9
[tests] Update the MT4162_dotnet to use new-style .NET availability attributes. Fixes #13517. (#13519)
Fixes https://github.com/xamarin/xamarin-macios/issues/13517.
2021-12-10 08:10:59 +01:00
Rolf Bjarne Kvinge ec94be597e
Use the '.NET 6 MAUI' channel for dotnet/runtime bits. (#13504)
We are in a situation where:

1. .NET MAUI is still in preview
2. We need dotnet/runtime fixes for MAUI, but we don't necessarily want all fixes to go into the .NET 6 service release.

The solution is to simplify use different builds/packs from dotnet/runtime.

Ref: https://github.com/xamarin/xamarin-android/pull/6542
2021-12-10 07:43:03 +01:00
Manuel de la Pena 45340e80f7
[Tests] Fix the retrieval of variables in .Net after quotes were added. Fixes #13516 (#13522)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-12-09 20:28:35 -05:00
Rolf Bjarne Kvinge a94e575806
[tools] Unify Application.link_flags and Application.gcc_flags from mtouch and mmp into Application.CustomLinkFlags. (#13509)
* [tools] Unify Application.link_flags and Application.gcc_flags from mtouch and mmp into Application.CustomLinkFlags.

* [tests] Update mtouch tests according to mtouch changes.
2021-12-09 17:16:45 +01:00
Rolf Bjarne Kvinge 169b851e63 [link sdk] Update test to work on macOS as well. 2021-12-09 16:08:47 +01:00
Rolf Bjarne Kvinge 52072f02e7 [link sdk] Update test according to recent dotnet/runtime changes. 2021-12-09 07:55:51 +01:00
Rolf Bjarne Kvinge 15a7216aa8
[ObjCRuntime] Remove deprecated availability attribute API from .NET. (#13433)
* [ObjCRuntime] Remove deprecated availability attribute API from .NET.

They're quite useful for binding code though, so instead of removing them completely,
make them binding-only attributes (like numerous other binding attributes we have)
for .NET.

* [src] Remove removed attributes from the list of attributes that should be removed by the linker.

* [tests] Update tests to not use the old attributes for .NET.
2021-12-09 07:41:07 +01:00
Manuel de la Pena 94b75d71c0
[CI] Ensure that we do have quotes in a variable with several values. (#13511) 2021-12-08 17:13:26 -05:00
Rolf Bjarne Kvinge b3c6218c5f
[msbuild] Improve logic to clean up the app bundle for macOS and Mac Catalyst apps before signing. (#13479)
There can't be any files in the root directory of the app bundle for macOS and
Mac Catalyst, otherwise code signing will fail. The problem is that Mono will
create a crash report in the current directory if the process crashes, and the
current directory is the root directory of the app bundle, which means that if
running an app crashes, the next build will likely fail because of the crash
report.

We had logic to detect this and remove any crash reports, but our crash report
detection pattern wasn't good enough and let some files through. This PR
updates that pattern, and also improves the code to report warnings for any
other files in the app bundle's root directory.
2021-12-07 21:33:22 +01:00
Rolf Bjarne Kvinge 90b8e89859
[src] Remove System.nint and System.nuint from .NET. Fixes #10508. (#13490)
* Remove System.nint and System.nuint from .NET
* Add support for C#'s nint/nuint types to the generator.
* Accept IntPtr/UIntPtr as target types for BindAs attributes for NSNumber conversions.
* Fix a few APIs to take/return NativeHandle instead of IntPtr.

Fixes https://github.com/xamarin/xamarin-macios/issues/10508.
2021-12-07 21:12:46 +01:00
Rolf Bjarne Kvinge 39bdae2b7f
[monotouch-test] Ignore a few tests in non-ARM64 simulators. (#13487)
* [monotouch-test] Ignore a few tests in non-ARM64 simulators.

Some tests fail when running on an M1, but in a x64_86 mode, so just ignore
those unless we're running on ARM64 (this will currently exclude them on
x86_64 hardware too, but that'll eventually not be a problem anymore when
there's no more x86_64 hardware, and just checking for ARM64 is easier than
checking for x86_64 mode on an ARM64 CPU).

* Make more legacy projects unsafe.
2021-12-07 21:10:39 +01:00
Přemek Vysoký 27cd6f78c3
[xharness] Compare the `TestExecutingResult.TimedOut` flag only (#13498) 2021-12-06 14:13:47 -05:00
Rolf Bjarne Kvinge d7d2409dc0 [tests] Adjust cecil-tests according to nint/nuint changes. 2021-12-03 18:36:36 +01:00
Rolf Bjarne Kvinge 61b897e054 [xtro] Update. 2021-12-03 18:26:22 +01:00
Rolf Bjarne Kvinge d2383796d4
[xharness] Add nullability to the TestProject class. (#13489)
Also simplify some code elsewhere to make that easier.
2021-12-03 18:24:03 +01:00
Rolf Bjarne Kvinge 39ab97113c
[src] Adjust numerous APIs to take/return NativeHandle instead of IntPtr for .NET. (#13488)
* [Foundation] Make numerous CFArray and NSArray APIs take/return NativeHandle instead of IntPtr.

* [src] Fix a lot of other cases of IntPtr -> NativeHandle.

This is just fallout from the CFArray/NSArray in the previous commit.
2021-12-03 07:58:29 +01:00
Rolf Bjarne Kvinge 44feba841e
[dotnet] Check for the x64 version of .NET. (#13481)
Check for the x64 version of .NET to see if it's installed if the default
dotnet location doesn't exist (the x64 version will exist on an ARM64 mac when
installing the x64 version of .NET).

Also allow the .NET unit tests to be executed using any recentish version of
.NET.
2021-12-03 07:56:23 +01:00
Rolf Bjarne Kvinge f8b6699ab2 Merge remote-tracking branch 'origin/main' into arm64-sim 2021-12-02 09:38:36 +01:00
Rolf Bjarne Kvinge 3f44ad5d6c [tests] Fix platform for test to actually make the test work. 2021-12-02 09:02:42 +01:00
Rolf Bjarne Kvinge 5cc92ac564
[src] Add a new ObjCRuntime.NativeHandle type to represent native handles for .NET. Fixes #13126. (#13356)
Add a new struct, ObjCRuntime.NativeHandle, which will be used to represent
native handles for .NET (instead of using IntPtr). The main purpose is to be
able to use 'nint' as a number in API while not being prevented from using
native handles as well.

One example is NSMutableString, which has a constructor that takes a single
'nint capacity' parameter. With this change, we'll also be able to have a
constructor that takes a native handle in .NET - otherwise we'd have two
constructors with the same signature, because a C# 'nint' is just an 'IntPtr'.

This change required numerous changes pretty much everywhere. The work is
split up in commits as well as I was able to, and each commit explains what it
does.

Fixes https://github.com/xamarin/xamarin-macios/issues/13126.
2021-12-02 08:38:39 +01:00
Rolf Bjarne Kvinge 941507525e
[tests] Unify .NET test projects (#13474)
* Make the .NET project files for BundleResources and EmbeddedResources follow
  the pattern of all the other test projects.
* Move the LangVersion and AllowUnsafeBlocks propertieso to the shared project
  file.
2021-12-01 20:00:14 +01:00
Rolf Bjarne Kvinge 9cf5964860 [tests] Update .NET unit tests to be aware that we can build for simulator/arm64 now. 2021-12-01 19:59:38 +01:00
Rolf Bjarne Kvinge 9d79dada8b
[AppKit] Add NSKey back to the .NET profile. (#13477)
It turns out the enum is used a bit more than I thought.

Ref: https://discord.com/channels/732297728826277939/732297808148824115/913810268939759626
2021-12-01 17:30:04 +01:00
Rolf Bjarne Kvinge fcaf5f3c9f
[tests] Fix checking availability for .NET. (#13470)
Change the logic to detect if an API is available to:

* First check if there are any applicable UnavailableOSPlatform attributes,
  and only if an applicable attribute is found, then state that the API is
  unavailable (we can't ascertain that an API is available from an
  UnavailableOSPlatform attribute, only that it's unavailable).
* Once we know there are no applicable UnavailableOSPlatform attributes, we go
  on to check for applicable SupportedOSPlatform attributes, and if one is
  found, then we can say whether the API is available or not.
* If neither attributes were found, and we're building for Mac Catalyst, then
  repeat the two above checks for iOS instead.
* If still nothing, then assume the API is available (while incorrect, it's
  how our attributes are currently implemented).

This fixes introspection showing numerous test failures on older OS versions,
because we were detecting availability wrong - we were assuming that if
there's an UnavailableOSPlatform attribute whose version didn't match the OS
version, that the API was available (test case that proves this logic is
incorrect: OS version = 1.0, API introduced in 2.0, API unavailable in 3.0
- we'd detect that OS version 1.0 < unavailable in 3.0, and say "yay, we're
not unavailable, so we must be available!").
2021-12-01 17:29:20 +01:00
Rolf Bjarne Kvinge f26dedd046 [monotouch-test] Set the AOT define if we're building for ARM64 in the simulator.
Also set DYNAMIC_REGISTRAR if we're targeting the simulator.
2021-11-30 18:20:43 +01:00
Rolf Bjarne Kvinge b0a4dbfe91 [xharness] Add arm64/simulator variations for introspection and monotouch-test 2021-11-30 18:20:43 +01:00
Rolf Bjarne Kvinge 8bf7b663be [tests] Build test libraries for [ios|tvos]simulator-arm64
This turned out a bit complicated, because we're lipo'ing together both the simulator
and device slices, and that doesn't work anymore when ARM64 is both a simulator and
a device architecture. The solution is a custom lipo logic that doesn't include the
simulator version of the ARM64 architecture in the final binary.
2021-11-30 18:20:43 +01:00
Rolf Bjarne Kvinge 78f52e2fc2
[msbuild/tests] Add support for xcframeworks with static libraries in them. (#13459)
* [tests] Create a libtest.xcframework and libtest2.xcframework

* [tests] Make bindings-test and bindings-test2 use an xcframework instead of plain static library

* [msbuild] Add support for xcframeworks with static libraries in them.

* List the frameworks libtest needs.

* [tests] Update .NET unit tests according to test project changes.

* [tests] Add new test to verify that packing an old-style binding project doesn't work.
2021-11-30 18:19:22 +01:00
Rolf Bjarne Kvinge fb11284785
[src] Remove the Xamarin.iOS.dll reference assembly for Mac Catalyst. (#13455)
* [src] Remove the Xamarin.iOS.dll reference assembly for Mac Catalyst.

Xamarin.iOS.dll won't be compatible with Mac Catalyst in .NET 6 (because there
won't be any backwards compatibility), so we don't need the assembly that has
type forwarders to Xamarin.MacCatalyst.dll.

* Bump MonoTouch.Dialog

New commits in migueldeicaza/MonoTouch.Dialog:

* migueldeicaza/MonoTouch.Dialog@4d0e0a9 Remove usages of UIWebView when compiling for Mac Catalyst.

Diff: 5a05c6912e..4d0e0a9a5f

* [tests] There's no NSFileProviderPage in Mac Catalyst.

* [tests] Fix CBUUID link sdk test to work correctly on Mac Catalyst.
2021-11-29 23:14:25 +01:00
Rolf Bjarne Kvinge 2aa21751a6
[dotnet] Show an error if an app developer tries to publish a simulator architecture. (#13462)
* [dotnet] Show an error if an app developer tries to publish a simulator architecture.

* We can't publish a simulator build, so show an error in that case.
* We can't change the default runtime identifier when publishing (to a
  publishable runtime identifier), because by the time we know we're
  publishing, it's too late to change the runtime identifier. This means that
  it'll be required for app developers to specify a runtime identifier when
  publishing to a mobile platform, since the current default runtime
  identifier is for a simulator build.

Partial fix for https://github.com/xamarin/xamarin-macios/issues/12997.

* Fix typo and improve naming.

* [dotnet] Don't use '_UsingDefaultRuntimeIdentifier', it's already used elsewhere in .NET
2021-11-29 23:13:48 +01:00
Rolf Bjarne Kvinge 00482325d1
[src] Add missing availability attributes in a few places. (#13422)
* [src] Add missing availability attributes in a few places.

* [src] Don't add availability attributes to error enums.

* [introspection] Change version check for Mac Catalyst to be 'greater than'.

We have a tests that verifies that the availability attributes for an API
doesn't state that the API was deprecated before or when it was introduced.

This sounds reasonable, except that Apple has introduced and deprecated entire
frameworks in the same Mac Catalyst version (probably because Apple decided to
port an already deprecated framework to Mac Catalyst).

Our test for this scenario was a bit too eager; this change will make it so
that (for Mac Catalyst only), we accept APIs that are introduced and
deprecated in the same Mac Catalyst version (not not APIs that were deprecated
before they were introduced).
2021-11-29 07:58:16 +01:00
Rolf Bjarne Kvinge c02cc7e27d
[introspection] Fix the ApiFrameworkTest.Simlauncher test to fail in case of errors. (#13456)
* Assert at the end of the test if there were any errors.
* Don't run this test for .NET, since we don't use a simlauncher in .NET.
2021-11-26 20:14:38 +01:00
Rolf Bjarne Kvinge 3f9666a8f7
[AppKit] Change NSTextViewDelegate.DraggedCell to use the recommended signature for .NET (#13460)
* [AppKit] Change NSTextViewDelegate.DraggedCell to use the recommended signature for .NET

The 'textView:draggedCell:inRect:event:' selector has been deprecated since
macOS 10.6, so just replace this with the recommended alternative.

* [generator] Make sure code compiles for parameter names that match C# keywords.
2021-11-26 20:02:15 +01:00
Rolf Bjarne Kvinge 19c2765156 [tests][monotouch-test] Adjust code to cope with NativeHandle. 2021-11-26 14:25:21 +01:00
Rolf Bjarne Kvinge ac13861e92 [tests][bgen] Adjust code to cope with NativeHandle. 2021-11-26 14:25:21 +01:00
Rolf Bjarne Kvinge a1d7224c6d [tests][introspection] A few test updates according to the API changes 2021-11-26 14:25:21 +01:00
Rolf Bjarne Kvinge b92f79fe1b [tests][cecil-tests] Add new test to verify the constructors we expose.
Verifies that:

* There shouldn't be any (IntPtr) or (IntPtr, bool) constructors.
* The (NativeHandle) or (NativeHandle, bool) constructors should not be public.
* The constructors correctly chain to the base constructor according to our usual
  pattern: the (IntPtr) ctor must chain to the self/base (IntPtr, bool) constructor
  passing 'false' for the owns parameter.
* The constructors don't have any extra code in them (barring a few exceptions).
2021-11-26 14:25:21 +01:00
Rolf Bjarne Kvinge 2bb5fc88c5
[src] Adjust visibility of numerous (IntPtr) and (IntPtr, bool) constructors (#13444)
* There should be no public (IntPtr) constructor, at most there should be a
  protected one for NSObject subclasses. There should be no such constructors
  for classes that just implement INativeObject.
* There should be no public (IntPtr, bool) constructor at all, they should all
  be internal.
* If changing the visibility or removing the ctor is a breaking change, then
  make it happen for .NET only.
2021-11-26 14:24:05 +01:00
Rolf Bjarne Kvinge b9e8d4869d
[xtro] Don't report missing availability attributes for enums representing errors. (#13445)
* We don't want availability attributes for enums that represent errors,
  because the code would end up unnecessarily complex to avoid warnings.
* We even have other tests to verify as much (cecil tests).
2021-11-26 07:22:58 +01:00
Rolf Bjarne Kvinge 85a9791b51
[tests] Some improvements for the bindings-test2 project for .NET. (#13447)
* Remove the watchOS project, we don't support watchOS for .NET at the moment.
* Rename shared.targets to shared.csproj to match all the other test projects.
* Move a bit more code into the shared project file (shared.csproj).
* Add a Makefile for each platform.
2021-11-26 07:22:34 +01:00
Rolf Bjarne Kvinge d51835b5b3
[AVFoundation] Fix availability for a few enums (#13451)
None of these are deprecated, so no reason for them to not exist in .NET.

Also update the availability attributes according to current headers.
2021-11-26 07:21:30 +01:00
Rolf Bjarne Kvinge 9013c72591
[AppKit] Remove the NSLayoutManager.LayoutOptions property and the NSGlyphStorageOptions enum in .NET. (#13453)
The former has been removed from the headers, so it's thoroughly deprecated,
and the latter is no longer needed anymore since it was only used by the
former.
2021-11-26 07:20:36 +01:00
Rolf Bjarne Kvinge 5ab9883af9
[AppKit] Remove NSAlertType from .NET, it's not used anywhere in our API, and it's deprecated in the headers. (#13454) 2021-11-26 07:20:21 +01:00
Rolf Bjarne Kvinge ce5dd1e61b
[AppKit] Remove NSKey from .NET, it's not used anywhere in our API, nor can I find it in headers. (#13448)
xtro also agrees that it shouldn't exist.
2021-11-25 23:37:48 +01:00
Rolf Bjarne Kvinge cbaead3753
[xtro] Remove unused file. (#13452)
Delete the 'osx.pending' file, it's not used. It looks like it should have
been removed in fffaba2414 (where the *.pending
files for the other platforms were removed).
2021-11-25 23:01:12 +01:00
Rolf Bjarne Kvinge 0c50905fc5
[tests] Fix boolean logic when checking for macOS version between 11.0 and 12.0 (#13446) 2021-11-25 22:35:24 +01:00
Rolf Bjarne Kvinge f52f763fa7 [xtro] Remove support for legacy Mac Catalyst. 2021-11-25 11:48:38 +01:00
Rolf Bjarne Kvinge df4399bbde
[CGImageSource] Change CreateThumbnail to return null if the thumbnail creation fails. (#13443)
Otherwise we'll create a CGImage with a zero Handle, which is usually not the
right thing to do. Still, keep the old behavior for legacy Xamarin for the
sake of backwards compat.
2021-11-25 07:36:24 +01:00
Rolf Bjarne Kvinge f916702568 [xharness] Don't run both legacy and .NET xtro at the same time. 2021-11-25 00:20:22 +01:00
Rolf Bjarne Kvinge 9cba70d183 [xtro] Update annotations. 2021-11-24 17:05:35 +01:00
Rolf Bjarne Kvinge 25b41c7ac3 [xtro] Fix dependencies for the .NET report. 2021-11-24 16:55:13 +01:00
Rolf Bjarne Kvinge 4445606653 [xtro] Run u2todo on the .NET annotations to update annotations according to current API. 2021-11-24 15:39:04 +01:00
Rolf Bjarne Kvinge 0cb2591e1a [xtro] Run autosanitize on the .NET annotations to update annotations according to current API. 2021-11-24 15:39:04 +01:00
Rolf Bjarne Kvinge 70333367a0 [xtro] Adjust the .NET annotations for nfloat and NSWritingDirection move. 2021-11-24 15:39:04 +01:00
Rolf Bjarne Kvinge aac316efbb [xtro] Add .NET annotations. 2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge 14c7909317 [xtro] Have a different map between native and managed enums for .NET and legacy Xamarin.
We've fixed a few managed enum names to match the native counterpart in .NET, which
means we need a different map too.
2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge fc39a0df5b [xtro-sharpie] Detect UnsupportedOSPlatform attributes as a deprecation attribute. 2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge fa55aab0b2 [xtro] Point to the actual .ignore file location when reporting ?unknown-entry?
This makes the output clearer when we have ignore files in multiple directories.
2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge 7e255ddcb5 [xharness] Add support for running xtro in .NET mode. 2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge 234f593511 [xtro] Run on .NET assemblies. 2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge 87c4fb0669 [xtro-report] Honor the input directory in a few places. 2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge 4baa67a07d
[xtro] Improve makefile. (#13424)
* Use proper dependency tracking, so that we'll only rebuild what needs to be rebuilt
  when rebuilding. This required using a few stamp files. It also improves parallel
  builds.
* Remove *.raw files before running xtro-sharpie, and only for the current platform.
  This makes sure rebuilds of just some of the platforms work correctly (because
  the *.raw files for other platforms are still around when needed).
* Build the u2todo project file instead of manually calling csc.
2021-11-24 15:38:10 +01:00
Rolf Bjarne Kvinge 03b352036a
[LocalAuthentication] Adjust code for .NET and fix availability of LAContext.MaxBiometryFailures (#13425)
* LAContext.MaxBiometryFailures is available in macOS, just deprecated, so mark
  it as such.
* Remove deprecated code from .NET.
* Update xtro definitions.
2021-11-24 15:37:56 +01:00
Rolf Bjarne Kvinge 98d7c95020
[MediaPlayer] Remove deprecated/removed API in .NET (#13427)
* [MediaPlayer] Remove deprecated/removed API in .NET

* [tests] Fix monotouch-test according to API changes.
2021-11-24 15:37:23 +01:00
Rolf Bjarne Kvinge 84c147a1db
[tests] Give up on LinkSdkRegressionTest.SpecialFolder on macOS and Mac Catalyst for the Favorites and Fonts folders (#13429)
* [tests] Try to fix LinkSdkRegressionTest.SpecialFolder on macOS 10.15.

* I give up.
2021-11-24 15:37:02 +01:00
Rolf Bjarne Kvinge 2901f7aba6
[tests] Adjust FontTest to cope with broken GameKit/UIKit/fontWithSize on certain macOS versions. (#13428)
Fixes:

    MonoTouchFixtures.UIKit.FontTest
        CoreText note: Client requested name ".SFNS-Regular", it will get Times-Roman rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
        CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
            [FAIL] NullFonts :   WithSize
            Expected: not null
            But was:  null
                at MonoTouchFixtures.UIKit.FontTest.NullFonts() in /Users/builder/azdo/_work/1/s/xamarin-macios/tests/monotouch-test/UIKit/FontTest.cs:line 165
2021-11-24 08:07:30 +01:00
Rolf Bjarne Kvinge ff345ba4eb
[xtro-sanity] Pass the included platforms as command line arguments. (#13420)
This avoids the need to compute them, and makes it possible to have multiple sets
of platforms.
2021-11-22 23:24:25 +01:00
Rolf Bjarne Kvinge 5329b19f62
[introspection] Migrate .NET code to use the new .NET-style availability attributes. (#13363)
* [tools] Extract the logic to parse OSPlatformAttribute platform names to a separate file/class.

* [introspection] Migrate .NET code to use the new .NET-style availability attributes.

This also means using the 'ApplePlatform' enum instead of the 'PlatformName'
enum, because the latter will be removed in .NET.

* [FileProvider] Exclude some deprecated API from .NET.

* [AVFoundation] Adjust availability attribute for AVCaptureStillImageOutput.HighResolutionStillImageOutputEnabled.

* Update tests.
2021-11-22 20:54:07 +01:00
Rolf Bjarne Kvinge b55ee6d521
[xtro] Improve enum check. (#13396)
* Unify the signed and unsigned implementations. We lose some type-safety (because
  we have to use 'object' as the unifying type between long and ulong), but we minimize
  code duplication, so the code becomes easier to maintain.
* Add an additional check for managed enum values that show up in the native header,
  but aren't available on the current platform.
2021-11-22 18:51:12 +01:00
Rolf Bjarne Kvinge 6302878ad5
[runtime] Implement storing the original working directory for later retrieval for .NET. Fixes #13392. (#13403)
This also adds the Runtime.OriginalWorkingDirectory to all platforms.

Fixes https://github.com/xamarin/xamarin-macios/issues/13392.
2021-11-22 18:50:28 +01:00
Rolf Bjarne Kvinge 3c5dfab710
[xtro-sharpie] Add support for specifying the output directory. (#13408)
This makes it possible to have a different output directory for .NET assemblies.
2021-11-22 18:50:17 +01:00
Rolf Bjarne Kvinge 88eb5e1ac8
Rename any *OSX_SDK_VERSION variables to *MACOS_SDK_VERSION. (#13411)
This makes it easier to iterate over all the *_SDK_VERSION variables in
template code, because they're all named using the standard platform names we
use elsewhere.
2021-11-22 18:48:05 +01:00
Rolf Bjarne Kvinge f8305e213f
Bump xharness. (#13406)
To get this fix: 769755cc98
2021-11-22 11:25:51 -05:00
Rolf Bjarne Kvinge 7fb12bc441
[tests] Disable signing in the Xamarin.MTouch.BindingLibraryDSymCreated test. Fixes #13404. (#13405)
The test builds an app that wants to be signed - but that requires signing
certificates. Instead just change the test to not require signing.

Fixes https://github.com/xamarin/xamarin-macios/issues/13404.
2021-11-22 14:18:00 +01:00