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

12249 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge cd173c4d23
[Class] Enable nullability + fix a few code updates. (#13281)
* [Class] Enable nullability + fix a few code updates.

* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Make the 'handle' field private.
* Remove the (IntPtr) constructor for .NET
* Make the (IntPtr, bool) constructor internal for .NET
* Remove unused 'Construct' method.

* Keep the public IntPtr constructor for Class.

It'll be the only way to create a Class instance given an IntPtr.
2021-11-08 16:13:45 +01:00
Rolf Bjarne Kvinge 1fab379c77
[Protocol] Enable nullability and fix a few issues. (#13280)
* [Protocol] Enable nullability and fix a few issues.

* Keep the public IntPtr constructor for Protocol.

It'll be the only way to create a Protocol instance given an IntPtr.
2021-11-08 16:13:19 +01:00
Rolf Bjarne Kvinge e0a676aa12
[AudioComponent] Enable nullability + a few other code updates (#13276)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Make the 'handle' field private.
* Use the 'Handle' property instead of accessing the private 'handle' field.
* Use CFString.CreateNative/ReleaseNative instead of other means to create
  native strings (the fastest and least memory hungry option).
* [AudioToolbox] Fix nullability issue to fix broken build.
2021-11-08 15:44:49 +01:00
Rolf Bjarne Kvinge fa8b78eb04
[AudioToolbox] Fix nullability issue to fix broken build. (#13304)
Fixes this compile error:

> AudioToolbox/MusicTrack.cs(256,11): error CS8603: Possible null reference return.
2021-11-08 15:37:02 +01:00
Rolf Bjarne Kvinge dc3e1e1448
[INativeObject] Enable nullability and fix a few issues. (#13279) 2021-11-08 08:56:55 +01:00
Rolf Bjarne Kvinge ba2e2e5971
[AUGraph] Enable nullability + a few other code updates (#13277)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Handle' property instead of accessing the private 'handle' field.
* Fix ownership logic: we can't call CFRetain on this type, but we can keep
  track of whether we own it or not.
* Call 'GetCheckedHandle ()' (which will throw an ObjectDisposedException if
  Handle == IntPtr.Zero) instead of manually checking for IntPtr.Zero and
  throwing ObjectDisposedException.
2021-11-08 08:56:42 +01:00
Rolf Bjarne Kvinge 62c280cb7d
[SystemSound] Enable nullability + a few other code updates (#13275)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Handle' property instead of accessing the private 'handle' field.
* Simplify some block code.
2021-11-08 08:56:16 +01:00
Rolf Bjarne Kvinge 6936ba512a
[MusicSequence] Enable nullability + a few other code updates (#13273)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Handle' property instead of accessing the private 'handle' field.
2021-11-08 08:55:58 +01:00
Rolf Bjarne Kvinge e171a50a31
[MusicTrack] Enable nullability + a few other code updates (#13272)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Handle' property instead of accessing the private 'handle' field.
* Rename the public '_MidiData' type to 'MidiData' for .NET.
* Remove some dead code.
2021-11-08 08:55:46 +01:00
Rolf Bjarne Kvinge 39e06c5a4f
[StoreKit] Remove unsupported SKAdNetwork code from .NET. (#13268) 2021-11-08 08:55:32 +01:00
Rolf Bjarne Kvinge 6af32cbfbd
[AudioToolbox] AudioConverter.FillComplexBuffer doesn't return a nullable value. (#13288)
Fixes this unintended breaking API change:

```diff
 Type Changed: AudioToolbox.AudioConverter

-public AudioConverterError FillComplexBuffer (ref int outputDataPacketSize, AudioBuffers outputData, AudioStreamPacketDescription[] packetDescription);
+public AudioConverterError? FillComplexBuffer (ref int outputDataPacketSize, AudioBuffers outputData, AudioStreamPacketDescription[] packetDescription);
```
2021-11-05 18:39:00 +01:00
Rolf Bjarne Kvinge 4d5ee3218d
[CoreLocation] CLProximity exists in macOS now, so remove the XAMCORE_4_0 condition to remove it. (#13274) 2021-11-05 18:38:28 +01:00
Rolf Bjarne Kvinge 857fbc52b8
[AudioUnit] Enable nullability + a few other code updates (#13278)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Handle' property instead of accessing the private 'handle' field.
2021-11-05 18:37:51 +01:00
Rolf Bjarne Kvinge 6b3ebd2a59
[AppKit] Remove NSEventSubtype from Mac Catalyst. (#13287)
Fixes this xtro failure:

> !unknown-native-enum! NSEventSubtype bound

Fixes https://github.com/xamarin/maccore/issues/2528.
2021-11-05 15:31:13 +01:00
Rolf Bjarne Kvinge 08c1dca26a
[AppKit/Foundation/UIKit] Use Foundation.NSWritingDirection instead of UIKit.UITextWritingDirection and AppKit.NSWritingDirection for .NET. Fixes #6573. (#13243)
Fixes when building with XAMCORE_4_0:

> uikit.cs(6775,3): error CS0246: The type or namespace name 'UITextWritingDirection' could not be found (are you missing a using directive or an assembly reference?)
> uikit.cs(6597,3): error CS0246: The type or namespace name 'UITextWritingDirection' could not be found (are you missing a using directive or an assembly reference?)
> uikit.cs(6601,41): error CS0246: The type or namespace name 'UITextWritingDirection' could not be found (are you missing a using directive or an assembly reference?)

Fixes https://github.com/xamarin/xamarin-macios/issues/6573.
2021-11-05 08:12:44 +01:00
Rolf Bjarne Kvinge 17d544f2b0
[iAd] Remove this framework from .NET. (#13269)
* [iAd] Remove this framework from .NET.

* [src] Use a different response file with HAS_<framework> defines for .NET.

This allows us to have different HAS_<framework> values for the .NET build (to
take into account frameworks that has been removed).

* Make the .NET framework removal logic per-platform.

* Use a different pattern in the rule to not match another pattern rule.
2021-11-05 08:07:18 +01:00
Rolf Bjarne Kvinge 0c6b3a7f77
[Dlfcn] Enable nullability and fix code accordingly. (#13282) 2021-11-05 08:04:04 +01:00
Rolf Bjarne Kvinge 8216ee6665
[AppKit] Fix a few enums for .NET according to current AppKit headers. (#13267)
* NSEventSubtype: add missing members, and make the underlying type 'short' for all platforms in .NET.
* NSSystemDefinedEvents, NSEventMouseSubtype: obsolete (and remove from .NET),
  and point to NSEventSubtype.
2021-11-04 17:01:46 +01:00
Manuel de la Pena 2db351bab5
[CI] Use a vimage for 10.15 since we do not have actual bots. (#13259) 2021-11-04 11:54:08 -04:00
Rolf Bjarne Kvinge e965cf761e
[CGPDFObject] Make CGPDFObject a subclass of CGPDF[Array|Dictionary|Stream] + a few other fixes. (#13253)
* Make CGPDFObject a common subclass for the CGPDF[Array|Dictionary|Stream]
  classes, and keep the object lifetime code there.
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Make any (IntPtr) constructors internal for .NET
* Simplify block creation code a bit.
2021-11-04 16:33:30 +01:00
Rolf Bjarne Kvinge 27bd4244f2
[Security/Authorization] Enable nullability + a few other code updates (#13266)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Handle' property instead of accessing the private 'handle' field.
2021-11-04 15:24:24 +01:00
Rolf Bjarne Kvinge f10b75f75c
[MusicPlayer] Enable nullability + a few other code updates (#13265)
* Enable nullability and fix code accordingly.
* Use 'is' and 'is not' instead of '==' and '!=' for object identity.
* Use 'nameof (parameter)' instead of string constants.
* Use the 'Handle' property instead of accessing the private 'handle' field.
2021-11-04 15:23:23 +01:00
Manuel de la Pena bd24746226
[Xtro] Fix xtro after a bad commit. (#13271) 2021-11-04 15:20:38 +01:00
Rolf Bjarne Kvinge b79c4f43b9
[AudioFile] Enable nullability + a few other code updates (#13264)
* 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-11-04 15:19:38 +01:00
Rolf Bjarne Kvinge 149dc99a6a
[Security/Items] Enable nullability + a few other fixes. (#13261)
* 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-11-04 15:18:18 +01:00
Rolf Bjarne Kvinge bf8337a4f9
[AudioConverter] Enable nullability + a few other code updates (#13258)
* 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-11-04 14:56:55 +01:00
Rolf Bjarne Kvinge 2ab75c4dcc
[AudioBuffers] Enable nullability + a few other fixes. (#13257)
* Enable nullability and fix code accordingly.
* Use 'nameof (parameter)' instead of string constants.
2021-11-04 14:56:01 +01:00
Rolf Bjarne Kvinge 2da529c328
[CGImageMetadataTag] Subclass NativeObject + numerous other code updates (#13240)
* [CGImageMetadataTag] Subclass NativeObject + numerous other code updates

* 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 the 'Runtime.GetNSObject<T> (IntPtr, bool)' overload to specify handle
  ownership, to avoid having to call NSObject.DangerousReleaes manually later.
* Remove the (IntPtr) constructor for .NET
* Fix nullability attribute.

* [tests] Don't dispose a property value.

It ends up being the object instance we've stored elsewhere, which we don't
expect to be disposed.
2021-11-04 14:54:06 +01:00
Rolf Bjarne Kvinge 696e7a5679
[ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere. (#13231)
* [ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere.

The PlatformHelper class is deprecated, so implement a new version that isn't
deprecated, and which shares a similar API between all platforms - the Check*
methods includes the name of the platform, because that makes it clearer which
version we're talking about from the call site. There's a quirk though:
there's no separate ChecktvOS or CheckMacCatalyst, because the system version
is the same as for iOS, so we can just use 'iOS'.

For macOS we can now use NSProcessInfo.ProcessInfo.OperatingSystemVersion to
determine the OS version, because it's supported in all versions of macOS we
support for .NET.

Fixes issues such as this when building with XAMCORE_4_0:

> CoreMedia/CMSync.cs(590,11): error CS0103: The name 'PlatformHelper' does not exist in the current context

* Bring back PlatformHelper.CheckSystemVersion, but only for !NET.

* [tests] Remove 32-bit macOS logic, it's long dead.

* [introspection] Implement OS version check using 'NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion' for macOS.

* [monotouch-test] Use TestRuntime.[Check|Assert]XcodeVersion instead of PlatformHelper.CheckSystemVersion.
2021-11-04 11:13:23 +01:00
dotnet-maestro[bot] a371598681
Update dependencies from https://github.com/dotnet/installer build 20211102.8 (#13241)
Microsoft.Dotnet.Sdk.Internal
 From Version 6.0.100-rtm.21527.11 -> To Version 6.0.100-rtm.21552.8

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2021-11-04 11:09:58 +01:00
Manuel de la Pena ea0ee04f30
[CoreAnimation] Add support for Xcode 13.1 rc. (#13227)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-11-03 18:52:48 -04:00
Manuel de la Pena b328512073
[Tests] Remove not needed usings in the CoreImage & CoreLocation tests. (#13256) 2021-11-03 17:24:44 -04:00
Marius Ungureanu 93ed602f94
[AppKit] Allow setting NSWindow.ContentView to null (#13244) 2021-11-03 17:15:12 -04:00
Manuel de la Pena ee3cfa63bb
[Tests] Remove not needed usings in the CoreGraphics tests. (#13255) 2021-11-03 17:13:47 -04:00
Rolf Bjarne Kvinge b64a7dae0f
[NaturalLanguage] Remove wrong XAMCORE_4_0 code. (#13246)
Fixes:

> naturallanguage.cs(470,20): error CS8639: The typeof operator cannot be used on a nullable reference type
2021-11-03 21:58:45 +01:00
Manuel de la Pena 992afaf971
[Tests] Remove not needed usings in the CoreBluetooth and CoreAudioKit tests. (#13252) 2021-11-03 16:50:09 -04:00
Manuel de la Pena 86ac68fc31
[Tests] Remove not needed usings in the CoreData and CoreFoundation tests. (#13254) 2021-11-03 16:48:48 -04:00
Manuel de la Pena 88cf4b0c17
[Tests] Remove not needed usings in the Contacts tests. (#13250) 2021-11-03 16:42:06 -04:00
Manuel de la Pena 44a1b37abf
[Tests] Remove not needed usings in the Compression tests. (#13249) 2021-11-03 16:38:08 -04:00
Manuel de la Pena 8e62275615
[Tests] Remove not needed usings in the CoreAnimation tests. (#13251) 2021-11-03 16:37:28 -04:00
Manuel de la Pena 26a90c9ab3
[Tests] Remove not needed usings in the BGTasks tests. (#13248) 2021-11-03 16:37:14 -04:00
Manuel de la Pena 0a4a6736e9
[Tests] Remove not needed usings in the AVFoundation tests. (#13247) 2021-11-03 16:35:51 -04:00
Rolf Bjarne Kvinge 0382f39730
[CTFrameSetter] Subclass NativeObject + numerous other code updates (#13239)
* 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-11-03 21:28:16 +01:00
Manuel de la Pena 42fcb4f1c5
[Tests] Remove not needed usings in the Network tests. (#13232) 2021-11-03 10:34:34 -04:00
Manuel de la Pena 69be49194e
[Tests] Remove not needed usings in the AudioToolboc tests. (#13234) 2021-11-03 10:34:02 -04:00
Manuel de la Pena 70936c3fcd
[Tests] Remove not needed usings in the AudioUnit tests. (#13235) 2021-11-03 10:33:42 -04:00
Manuel de la Pena 3b47f94f94
[Tests] Remove not needed usings in the Foundation tests. (#13233) 2021-11-03 10:33:17 -04:00
Rolf Bjarne Kvinge e7b777a927
[CGPDFDocument] Subclass NativeObject + numerous other code updates (#13214)
* 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.
* Remove the (IntPtr) constructor for .NET
2021-11-03 14:45:41 +01:00
Rolf Bjarne Kvinge 4b81c5d143
[QTKit] Remove the QTKit framework from .NET. (#13224)
The QTKit framework does not exist on macOS anymore, so just remove our
bindings for it now that we can break compatibility.

Fixes a lot of errors like this when building with XAMCORE_4_0:

> build/dotnet/macos/generated-sources/Accessibility/AXCategoricalDataAxisDescriptor.g.cs(14,7): error CS0246: The type or namespace name 'QTKit' could not be found (are you missing a using directive or an assembly reference?)
> build/dotnet/macos/generated-sources/Accessibility/AXChart.g.cs(14,7): error CS0246: The type or namespace name 'QTKit' could not be found (are you missing a using directive or an assembly reference?)
> build/dotnet/macos/generated-sources/Accessibility/AXChartDescriptor.g.cs(14,7): error CS0246: The type or namespace name 'QTKit' could not be found (are you missing a using directive or an assembly reference?)
> build/dotnet/macos/generated-sources/Accessibility/AXChartDescriptorContentDirection.g.cs(14,7): error CS0246: The type or namespace name 'QTKit' could not be found (are you missing a using directive or an assembly reference?)
> build/dotnet/macos/generated-sources/Accessibility/AXCustomContent.g.cs(14,7): error CS0246: The type or namespace name 'QTKit' could not be found (are you missing a using directive or an assembly reference?)
> build/dotnet/macos/generated-sources/Accessibility/AXCustomContentImportance.g.cs(14,7): error CS0246: The type or namespace name 'QTKit' could not be found (are you missing a using directive or an assembly reference?)
> [...]
2021-11-03 08:48:34 +01:00
Rolf Bjarne Kvinge 122897f23c
[CTParagraphStyle] Subclass NativeObject + numerous other code updates (#13226)
* 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.
* Use Array.Empty<T> instead of creating an empty array manually.
2021-11-03 08:46:41 +01:00