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

12816 Коммитов

Автор SHA1 Сообщение Дата
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
Steve Hawley 9842974c0d
[NET 6 Attribute Conversion] MediaPlayer (#13975)
* Remove existing attributes

* attribute conversion

* using needed

* merged IOS blocks
2022-02-02 10:18:45 -05: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
TJ Lambert f4e2c3b28a
[NET 6 Attribute Conversion] NaturalLanguage (#13997)
* Remove existing attributes

* Attribute Conversion

* reverting changes to NaturalLanguage/Enums.cs

Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
2022-02-02 06:15:59 -06:00
Rolf Bjarne Kvinge 241d821983
[runtime] Don't try to log an exception for GCHandle that has been freed. (#14003)
It does exactly what you'd think it does: nothing helpful at all.

Make sure to use a GCHandle that's alive instead.

Output before fix:

    Xamarin.Mac: Processing managed exception for exception marshalling (mode: 2):
    Failed to print exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at ObjCRuntime.Runtime.PrintException(Exception exc, Boolean isInnerException, StringBuilder sb)
       at ObjCRuntime.Runtime.PrintAllExceptions(IntPtr exception_gchandle)

Output after fix:

    Xamarin.Mac: Processing managed exception for exception marshalling (mode: 2):
    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 0x7f89e6c2a2a0 (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 08:38:52 +01:00
Rolf Bjarne Kvinge 68aaef9ff7
[dotnet] Ask the linker to not mark copied assemblies if we're in a 'don't link' scenario. (#14011)
This speeds up builds significantly when the linker is disabled.

Test case: building tests/dotnet/MySimpleApp for macOS.

* Before: 37s
* After: 9s
* Difference: 26s (4x faster)

Test case: run the .NET tests

* Before: 2h55
* After: 1h43
* Difference: 1h12 (1.7x faster)

Contributes towards https://github.com/xamarin/xamarin-macios/issues/10251.
Ref: https://github.com/dotnet/linker/issues/2089
2022-02-02 08:36:17 +01:00
Rolf Bjarne Kvinge 16c3268ab3
[ExternalAccessory] Adopt XAMCORE_4_0 changes in .NET. (#14009) 2022-02-02 08:13:01 +01:00
Rolf Bjarne Kvinge 4b1738826f
[FileProvider] Adopt XAMCORE_4_0 changes in .NET. (#14012) 2022-02-02 08:01:06 +01:00
Sebastien Pouliot b9037da426
[coreimage] Modernize CIFilter (#14014)
* [coreimage] Modernize CIFilter

* Use faster `CFString` API (over the slower `NSString` variants)
* Rework internal API to use handles whenever possible
* Better use (and dispose) of `NSNumber`
* Use `ThrowHelper` to throw common exceptions

* Add related binding changes
2022-02-02 07:45:17 +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 db6a3b278e
[ObjCRuntime] Improve code to render an exception to avoid a NullReferenceException in case of invalid input. (#14004)
Output before fix:

    Xamarin.Mac: Processing managed exception for exception marshalling (mode: 2):
    Failed to print exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at ObjCRuntime.Runtime.PrintException(Exception exc, Boolean isInnerException, StringBuilder sb)
       at ObjCRuntime.Runtime.PrintAllExceptions(IntPtr exception_gchandle)

Output after fix:

    Xamarin.Mac: Processing managed exception for exception marshalling (mode: 2):
    Unable to print exception handle 0x102ca12b8: null exception

while not much more informative, it's at least not throwing a NullReferenceException that seems unexpected.
2022-02-01 21:12:50 +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 1cf35d5787
[Accounts] Adopt XAMCORE_4_0 changes in .NET. (#13994) 2022-02-01 19:46:15 +01:00
Chris Hamons c171b6fec9
[NET 6 Attribute Conversion] Foundation (#13905) 2022-02-01 11:23:14 -06:00
Chris Hamons ee1e8cb528
[NET 6 Attribute Conversion] CoreVideo (#13889) 2022-02-01 11:22:12 -06: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 5d4cc0e8d1
[CoreLocation] Fix availability attributes for a few API to match current state of the framework. (#14000) 2022-02-01 12:22:52 +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
Steve Hawley 1886681621
[NET 6 Attribute Conversion] MediaToolbox (#13976)
* Remove existing attributes

* Attribute Conversion

* missing using
2022-01-31 17:38:38 -05: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 535507dc81
[VideoToolbox] Adopt XAMCORE_4_0 changes in .NET. (#13985) 2022-01-31 21:53:23 +01:00
Rolf Bjarne Kvinge 1245ca4df7
[IdentityLookup] Adopt XAMCORE_4_0 changes in .NET. (#13989) 2022-01-31 21:46:17 +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 44f6cb24e5
[NET 6 Attribute Conversion] MapKit (#13952) 2022-01-31 14:02:29 -06:00
Chris Hamons fdd8410c80
[NET 6 Attribute Conversion] MediaAccessibility (#13951) 2022-01-31 14:00:55 -06:00
Chris Hamons 8847daa6b0
[NET 6 Attribute Conversion] HealthKit (#13950) 2022-01-31 14:00:07 -06:00
Chris Hamons c6582236b5
[NET 6 Attribute Conversion] ImageIO (#13947) 2022-01-31 13:50:42 -06:00
TJ Lambert 5d79b74759
[NET 6 Attribute Conversion] GameController (#13912) 2022-01-31 13:49:05 -06:00
Chris Hamons 948774c223
[NET 6 Attribute Conversion] MlCompute (#13946) 2022-01-31 13:32:06 -06:00
Chris Hamons a16c79c50a
[NET 6 Attribute Conversion] FileProvider (#13901) 2022-01-31 13:31:00 -06:00
Chris Hamons aa8d57ea66
[NET 6 Attribute Conversion] EventKitUI (#13900) 2022-01-31 13:30:20 -06:00
Chris Hamons 5ce7d626b8
[NET 6 Attribute Conversion] CoreWlan (#13898) 2022-01-31 13:29:51 -06:00
Chris Hamons e8663ebbc7
[NET 6 Attribute Conversion] CoreFoundation (#13816) 2022-01-31 13:27:23 -06:00
Rolf Bjarne Kvinge ffe3dc1575
[iTunesLibrary] Adopt XAMCORE_4_0 changes in .NET. (#13982) 2022-01-31 18:21:16 +01:00
Rolf Bjarne Kvinge a8f1fafe5a
[src] Fix numerous compiler warnings. (#13969)
Fixes:

    ObjCRuntime/Runtime.cs(64,15): warning CS0649: Field 'Runtime.MTRegistrationMap.protocol_wrapper_count' is never assigned to, and will always have its default value 0
    ObjCRuntime/Runtime.cs(111,18): warning CS0649: Field 'Runtime.Trampolines.ctor_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(58,33): warning CS0649: Field 'Runtime.MTRegistrationMap.protocol_wrapper_map' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(63,15): warning CS0649: Field 'Runtime.MTRegistrationMap.skipped_map_count' is never assigned to, and will always have its default value 0
    CoreText/CTStringAttributes.cs(104,37): warning CS0649: Field 'CTStringAttributeKey.WritingDirection' is never assigned to, and will always have its default value null
    ObjCRuntime/Runtime.cs(125,18): warning CS0649: Field 'Runtime.Trampolines.get_flags_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(121,18): warning CS0649: Field 'Runtime.Trampolines.copy_with_zone_2' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(61,15): warning CS0649: Field 'Runtime.MTRegistrationMap.map_count' is never assigned to, and will always have its default value 0
    ObjCRuntime/Runtime.cs(117,18): warning CS0649: Field 'Runtime.Trampolines.long_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(56,18): warning CS0649: Field 'Runtime.MTRegistrationMap.full_token_references' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(126,18): warning CS0649: Field 'Runtime.Trampolines.set_flags_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(104,18): warning CS0649: Field 'Runtime.Trampolines.tramp' is never assigned to, and will always have its default value
    CoreText/CTStringAttributes.cs(101,37): warning CS0649: Field 'CTStringAttributeKey.BaselineInfo' is never assigned to, and will always have its default value null
    ObjCRuntime/Runtime.cs(60,15): warning CS0649: Field 'Runtime.MTRegistrationMap.assembly_count' is never assigned to, and will always have its default value 0
    ObjCRuntime/Runtime.cs(116,18): warning CS0649: Field 'Runtime.Trampolines.x86_double_abi_static_stret_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(106,18): warning CS0649: Field 'Runtime.Trampolines.fpret_single_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(105,18): warning CS0649: Field 'Runtime.Trampolines.stret_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(113,18): warning CS0649: Field 'Runtime.Trampolines.static_fpret_single_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(120,18): warning CS0649: Field 'Runtime.Trampolines.copy_with_zone_1' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(62,15): warning CS0649: Field 'Runtime.MTRegistrationMap.full_token_reference_count' is never assigned to, and will always have its default value 0
    ObjCRuntime/Runtime.cs(118,18): warning CS0649: Field 'Runtime.Trampolines.static_long_tramp' is never assigned to, and will always have its default value
    CoreText/CTStringAttributes.cs(102,37): warning CS0649: Field 'CTStringAttributeKey.BaselineReferenceInfo' is never assigned to, and will always have its default value null
    ObjCRuntime/Runtime.cs(59,25): warning CS0649: Field 'Runtime.MTRegistrationMap.protocol_map' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(108,18): warning CS0649: Field 'Runtime.Trampolines.release_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(55,23): warning CS0649: Field 'Runtime.MTRegistrationMap.map' is never assigned to, and will always have its default value
    CoreText/CTStringAttributes.cs(100,37): warning CS0649: Field 'CTStringAttributeKey.BaselineClass' is never assigned to, and will always have its default value null
    ObjCRuntime/Runtime.cs(123,18): warning CS0649: Field 'Runtime.Trampolines.get_gchandle_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(57,30): warning CS0649: Field 'Runtime.MTRegistrationMap.skipped_map' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(65,15): warning CS0649: Field 'Runtime.MTRegistrationMap.protocol_count' is never assigned to, and will always have its default value 0
    ObjCRuntime/Runtime.cs(124,18): warning CS0649: Field 'Runtime.Trampolines.set_gchandle_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(115,18): warning CS0649: Field 'Runtime.Trampolines.static_stret_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(54,18): warning CS0649: Field 'Runtime.MTRegistrationMap.assembly' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(109,18): warning CS0649: Field 'Runtime.Trampolines.retain_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(114,18): warning CS0649: Field 'Runtime.Trampolines.static_fpret_double_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(107,18): warning CS0649: Field 'Runtime.Trampolines.fpret_double_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(110,18): warning CS0649: Field 'Runtime.Trampolines.static_tramp' is never assigned to, and will always have its default value
    ObjCRuntime/Runtime.cs(112,18): warning CS0649: Field 'Runtime.Trampolines.x86_double_abi_stret_tramp' is never assigned to, and will always have its default value
2022-01-31 17:53:23 +01:00
Rolf Bjarne Kvinge 2bb1bbb4d3
[MapKit] Adopt XAMCORE_4_0 changes in .NET. (#13970) 2022-01-31 17:51:41 +01: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 1bc37dcaf6
[ObjCRuntime] Adopt XAMCORE_4_0 changes in .NET. (#13980) 2022-01-31 17:48:50 +01:00
Rolf Bjarne Kvinge 4abf623235
[Security] Adopt XAMCORE_4_0 changes in .NET. (#13981) 2022-01-31 17:24:37 +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 990b570df5
[HomeKit] Adopt XAMCORE_4_0 changes in .NET. (#13967) 2022-01-31 16:58:51 +01:00
Rolf Bjarne Kvinge d8c2e5e040
[HealthKit] Adopt XAMCORE_4_0 changes in .NET. (#13968) 2022-01-31 16:57:26 +01:00