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

11958 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge cc5a1ea94e
[CFHTTPAuthentication] Indirectly subclass NativeObject + numerous other code updates (#13107)
* The base class CFType now subclasses NativeObject, so we can remove a lot of unnecessary code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Remove the internal (IntPtr) constructor.
2021-10-26 08:27:23 +02:00
Rolf Bjarne Kvinge 90228391d4
[Policy] Subclass NativeObject + numerous other code updates (#13108)
* Subclass NativeObject to reuse object lifetime code.
* This needed another constructor overload in NativeObject that validates that
  the handle is valid, since the Policy class verifies that.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Remove the (IntPtr) constructor for XAMCORE_4_0.
2021-10-26 08:22:56 +02:00
Rolf Bjarne Kvinge 94a7e815ce
[Trust] Subclass NativeObject + numerous other code updates (#13104)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle == IntPtr.Zero) instead of manually checking for IntPtr.Zero and
  throwing ObjectDisposedException.
* Remove the (IntPtr) constructor for XAMCORE_4_0.
2021-10-26 08:21:30 +02:00
Rolf Bjarne Kvinge 79fc7433c2
[CGColorSpace] Subclass NativeObject + numerous other code updates (#13089)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle == IntPtr.Zero) instead of manually checking for IntPtr.Zero and
  throwing ObjectDisposedException.
* Add a FromHandle method that creates a CGColorSpace from an IntPtr, checking
  for IntPtr.Zero first, to deduplicate a lot of code.
2021-10-26 08:19:52 +02:00
Rolf Bjarne Kvinge b70e6f4674
Submodule MonoTouch.Dialog. (#13058)
* Submodule MonoTouch.Dialog.

Submodule MonoTouch.Dialog, so that we can easily build it using .NET. This
submodule will become redundant when/if we publish a .NET version of
MonoTouch.Dialog, but until that happens we need it at least for our own test
suites.

This also means we have to copy our NuGet.config and global.json files to the
MonoTouch.Dialog project directory so that we point msbuild to use our local
build.

New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@cbda703 [Touch.Client] Use MonoTouch.Dialog from a submodule. (#109)

Diff: 3345db2f4e..cbda703583

* Use relative path for submodule.

And fix indentation and set the branch name.

* Don't use 'RootTestsDirectory' when it might not be defined yet.

* [tests] Our test projects don't need to reference MonoTouch.Dialog directly.

The projects get the MonoTouch.Dialog reference indirectly through the
Touch.Client project reference.

* [tests] Only validate unique errors in the .NET unit tests.

* [tests] No need to reference System.Json anymore, that's handled directly in the MonoTouch.Dialog project.

* [tests] Reference nunit.framework.targets so we get a workaround for an NUnit issue everywhere.

* [msbuild] Only try to create a package if we're able to create an app bundle.

This fixes an issue where a library project would try (and fail) to create a
package when 'CreatePackage=true' (which could be set for the executable
project, but inherited by the library project since the executable project
depends on it).

* [tests] Adjust PackTest.BindingXcFrameworksProject to not set the AssemblyName property.

MSBuild ends up being very confused when the project we're trying to build
depends on other projects, because AssemblyName is set for all the projects
being build, and MSBuild complains about ambiguous projects:

> error: Ambiguous project name 'bindings-xcframework-test'
2021-10-26 08:18:34 +02:00
Manuel de la Pena aca9bb0046
[WebKit] Add support for Xcode 13.1 rc. (#13052)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-10-25 20:13:00 -04:00
Rolf Bjarne Kvinge 44f88fcd92
[SslContext] Subclass NativeObject + numerous other code updates (#13105)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
2021-10-25 21:14:14 +02:00
Rolf Bjarne Kvinge 959c65d06c
[CGFunction] Subclass NativeObject + numerous other code updates (#13090)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle == IntPtr.Zero) instead of manually checking for IntPtr.Zero and
  throwing ObjectDisposedException.
* Remove the (IntPtr) constructor for XAMCORE_4_0.
2021-10-25 19:11:34 +02:00
Chris Hamons ab5c0c6b56
[net6] Fix ILStrip'ed apps to actually work again (#13098)
* [net6] Fix ILStrip'ed apps to actually work again

- In a late minute change to the ILStrip PR (https://github.com/xamarin/xamarin-macios/pull/12563) a change to support XVS support broke execution of Apps that were stripped
- Applications were broken because none of the stripped assemblies were actually copied into the bundle
- However, the tests still passed, because all assemblies that were there had no IL (zero assemblies total)

Now why did this happen?
- The stripped assemblies were changed to return via an msbuild Output Element
- Output Element can return an Property or ItemGroup, depending if you use the PropertyName or ItemName attributes
- Unfortunately I used PropertyName, when I expected an ItemGroup. So I silently had a property created instead.
- Thus zero items were added to the list of files to copy into the bundle
- Which was undetected as the test did not confirm files were copied in, and manual tests were not run so late into the PR (3 weeks after PR was opened)

How was it fixed?
- Correctly using ItemName on Output created a valid item group to reference
- However, that still failed with an absurdly confusing error:

 PATH/Microsoft.NET.Publish.targets(277,5): error MSB3024: Could not copy the file FILE to the destination file PATH, because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles.

- After a splunking through netcore targets, I found the metadata on these assemblies references really matters. Without it, they are not processed correctly at all.
- Thus, I updated ILStripBase to clone the existing metadata when changing the original assembly reference to the stripped path
- Finally, I corrected the test to assert that required files are copied in. I also manually ran our device test.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-10-25 11:31:42 -05:00
Rachel Kang 5d09fd774e
Merge pull request #13080 from rachelkang/cat_corewlan
[CoreWLAN] Updates for Catalyst
2021-10-25 10:44:47 -04:00
Rachel Kang 8ab022e8f0
Merge pull request #13097 from rachelkang/cat_uikit
[UIKit] Updates for Catalyst
2021-10-25 10:44:20 -04:00
Rolf Bjarne Kvinge dbe31e91df
[CFType] Subclass NativeObject + a few other code updates (#13086)
* Subclass NativeObject to reuse object lifetime code. This isn't for CFType
  itself, but all its subclasses.
* Add a public default constructor to maintain compat, but remove it for XAMCORE_4_0.
* Add an internal (IntPtr, bool) constructor to follow the NativeObject pattern.
* Enable nullability and fix code accordingly.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use 'nameof (parameter)' instead of string constants.
2021-10-25 15:19:00 +02:00
Rolf Bjarne Kvinge 0ede53d01b
[ABRecord] Subclass NativeObject + numerous other code updates (#13085)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
2021-10-25 10:57:24 +02:00
Rolf Bjarne Kvinge 22b8c38d36
[UIFontFeature] Enable nullability + a few other code updates (#13088)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
2021-10-25 10:56:19 +02:00
Rolf Bjarne Kvinge c3574a53a3
[generator] Use '[U]IntPtr' in P/Invoke signatures instead of 'n[u]int'. (#13043)
* [generator] Use '[U]IntPtr' in the P/Invoke signature for native enums.

* Use '[U]IntPtr' as the parameter type in the P/Invoke signature for native enum
  parameters.
* Use '[U]IntPtr' in the P/Invoke method name for native enum parameters.
* Add an explicit conversion from UIntPtr to nuint (like we already have from IntPtr
  to nint).

This makes the code identical between .NET and legacy Xamarin when using C# n[u]ints,
because those are really [U]IntPtrs.

* Use IntPtr/UIntPtr for all nint/nuint types in P/Invokes, not only native enums.

* Add a few more casts

Fixes these generator tests:

* GeneratorTests.BGenTests.FieldEnumTests
* GeneratorTests.BGenTests.NativeEnum

* [registrar] Handle UIntPtr like we do IntPtr.

Fixes this error in numerous tests:

    error MT4169: Failed to generate a P/Invoke wrapper for objc_msgSend(System.IntPtr,System.IntPtr): The registrar cannot build a signature for type `System.Void' in method `ObjCRuntime.Messaging.objc_msgSend`.

* [NativeTypes] Make IntPtr and UIntPtr behave the same.

This fixes an issue where the linked output for a 32-bit mscorlib.dll and a
64-bit mscorlib.dll would be different, because different explicit operators
for UIntPtr would be kept.

The fix works because the conversion operators for nuint will not use
UIntPtr's explicit conversion operators anymore, it will just operate on plain
memory instead.
2021-10-25 10:56:02 +02:00
Rolf Bjarne Kvinge 2ff5743bf1
[dotnet] Bump to preview 11. (#13082) 2021-10-25 10:32:21 +02:00
Rachel Kang e8c066b123
[UIKit] Updates for Catalyst 2021-10-22 17:28:32 -04:00
TJ Lambert 560d777b92
[ApiDiffs] Applying the New Dotnet ApiDiffs to Github (#13027) 2021-10-22 10:25:33 -05:00
Rachel Kang 3b1df5b27f
Merge pull request #13076 from rachelkang/cat_printcore
[PrintCore] Updates for Catalyst
2021-10-22 11:14:20 -04:00
Rachel Kang 410237ff14
Merge pull request #13056 from rachelkang/xcode13.0-intentsui-b1-b4
[IntentsUI] Update bindings for Xcode13.0 betas 1, 4
2021-10-22 11:02:05 -04:00
Rolf Bjarne Kvinge 91e3537085
[ABPerson] Enable nullability + numerous other code updates (#13079)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
2021-10-22 09:24:25 +02:00
Rolf Bjarne Kvinge 1caaf4bc89
[CFPropertyList] Subclass NativeObject + numerous other code updates (#13077)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Remove the (IntPtr) constructor for XAMCORE_4_0.
* Make the (IntPtr, bool) constructor internal for XAMCORE_4_0.
2021-10-22 09:23:05 +02:00
Rolf Bjarne Kvinge aa94452f27
[CFMessagePort] Subclass NativeObject + numerous other code updates (#13075)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle == IntPtr.Zero) instead of manually checking for IntPtr.Zero and
  throwing ObjectDisposedException.
* Remove the (IntPtr) constructor..
2021-10-22 09:22:56 +02:00
Rolf Bjarne Kvinge 96139baa0b
[CMBufferQueue] Subclass NativeObject + numerous other code updates (#13074)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
2021-10-22 09:22:44 +02:00
Rolf Bjarne Kvinge eb6c2aeb95
[CFNotificationCenter] Subclass NativeObject + numerous other code updates (#13073)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Remove the (IntPtr) constructor.
2021-10-22 09:22:31 +02:00
Rolf Bjarne Kvinge cae17e22f1
[CFMachPort] Subclass NativeObject + numerous other code updates (#13070)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Remove the (IntPtr) constructor for XAMCORE_4_0.
* Make the (IntPtr, bool) constructor internal for XAMCORE_4_0.
2021-10-22 09:21:57 +02:00
Rolf Bjarne Kvinge e9b66f4a8d
[CFDictionary] Subclass NativeObject + numerous other code updates (#13069)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use 'nameof (parameter)' instead of string constants.
* Remove the (IntPtr) constructor (which is not a breaking change because the type isn't public).
* Make the (IntPtr, bool) constructor internal (which is not a breaking change because the type isn't public).
2021-10-22 09:21:24 +02:00
Rolf Bjarne Kvinge 91a19d0a78
[CFData] Subclass NativeObject + numerous other code updates (#13068)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
2021-10-22 09:20:37 +02:00
Rolf Bjarne Kvinge ac92db2e5e
[CGBitmapContext] Enable nullability + numerous other code updates (#13067)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
2021-10-22 09:20:20 +02:00
Rolf Bjarne Kvinge c1777e87c3
[NetworkReachability] Subclass NativeObject + numerous other code updates (#13059)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
2021-10-22 09:19:35 +02:00
Rolf Bjarne Kvinge 3113c73be1
[CMFormatDescription] Subclass NativeObject + numerous other code updates (#13078)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Remove a few internal (IntPtr) constructors.
2021-10-22 09:18:59 +02:00
Rolf Bjarne Kvinge af23d61926
[runtime] Fix a toggle ref deadlock when retaining objects. Fixes #13066. (#13071)
The deadlock goes like this:

1. Thread A holds the framework_peer_release_lock lock, and tries to lock the
   refcount_mutex lock.
2. Thread B holds the refcount_mutex, and is waiting for the GC to complete
3. Thread C is trying to lock the framework_peer_release_lock while running
   the GC.

The fix is in thread A, by not doing anything at all with the
framework_peer_release_lock lock locked.

The code contains extensive comments explaining the situation and the solution.

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

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2021-10-22 09:05:07 +02:00
dotnet-maestro[bot] 3e457c4520
Update dependencies from https://github.com/dotnet/installer build 20211021.3 (#13072)
Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-rtm.21519.25 -> To Version 6.0.100-rtm.21521.3

Dependency coherency updates

Microsoft.NET.ILLink.Tasks
 From Version 6.0.100-1.21473.1 -> To Version 6.0.100-1.21519.4 (parent: Microsoft.Dotnet.Sdk.Internal

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2021-10-22 08:32:08 +02:00
Rachel Kang f708a4e9da
[CoreWLAN] Updates for Catalyst 2021-10-21 16:03:25 -04:00
github-actions[bot] c2bc32fbb6
[Localization] Pulling New Localization Translations 1355767016 (#13023) 2021-10-21 12:46:55 -05:00
TJ Lambert 7e89a3dccb
[Github Actions] Get rid of annoying failure emails (#13028) 2021-10-21 11:40:38 -05:00
Rolf Bjarne Kvinge 6090611123
[ABMultiValue] Subclass NativeObject + numerous other code updates (#13065)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Use Array.Empty<T> instead of creating an empty array manually.
2021-10-21 18:14:16 +02:00
Rolf Bjarne Kvinge a862d505de
[CFBundle] Subclass NativeObject + numerous other code updates (#13041)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create native
  strings (the fastest and least memory hungry option).
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle  == IntPtr.Zero) instead of manually checking for IntPtr.Zero and throwing
  ObjectDisposedException.
* Use CFArray helper methods to create arrays (and implement some helper methods
  that didn't exist).
* Add a few tests for the new CFArray helper methods.
2021-10-21 18:04:08 +02:00
Rachel Kang f1ff6ae0cb
Merge pull request #13062 from rachelkang/cat_security
[Security] Updates for Catalyst
2021-10-21 10:49:30 -04:00
Rachel Kang 39ca46b58f
[PrintCore] Updates for Catalyst 2021-10-21 10:36:54 -04:00
Rachel Kang 9bb7267b72
[UserNotifications] Updates for Catalyst (#13057) 2021-10-21 10:12:48 -04:00
TJ Lambert 07e9087f18
[GithubActions] Remove debugging dumps (#13063)
Co-authored-by: TJ Lambert <tjlambert@microsoft.com>
2021-10-21 10:12:17 -04:00
dotnet-maestro[bot] 9daab44f14
Update dependencies from https://github.com/dotnet/installer build 20211019.25 (#13049)
Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-rtm.21518.63 -> To Version 6.0.100-rtm.21519.25

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2021-10-21 08:49:40 +02:00
Rolf Bjarne Kvinge e8ae2103bf
[ABAddressBook] Subclass NativeObject + numerous other code updates (#13061)
* Subclass NativeObject to reuse object lifetime code.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* Use the null-safe NativeObjectExtensions.GetHandle extension method to get
  the handle instead of checking for null (avoids some code duplication).
* Use 'nameof (parameter)' instead of string constants.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle == IntPtr.Zero) instead of manually checking for IntPtr.Zero and
  throwing ObjectDisposedException.
* Simplify block creation code a bit.
2021-10-21 07:30:05 +02:00
Alex Soto 9c90fa8842
[CI] Update SignList.xml to fix publishing 2021-10-20 21:46:13 -04:00
Rachel Kang 816766b834
Update based on feedback 2021-10-20 17:39:11 -04:00
Rachel Kang a392357eb0
[Security] Updates for Catalyst 2021-10-20 17:34:11 -04:00
Rolf Bjarne Kvinge 1cff1ddf3e
[FSEvents] Fix compiler warning about nullability. (#13050)
Fixes this warning:

    CoreServices/FSEvents.cs(107,11): warning CS8605: Unboxing a possibly null value.
2021-10-20 22:23:17 +02:00
Rolf Bjarne Kvinge 808419f3c3
[tests] Fix the name of monotouchtest. (#13042)
Fix the name of monotouchtest, so that the app/executable is found by the
makefile when trying to execute the test.
2021-10-20 21:17:55 +02:00
Rachel Kang 56b454a8cb
[IntentsUI] Update bindings for Xcode13.0 betas 1,4 2021-10-20 14:33:42 -04:00