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

14990 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge a34b630304 [Foundation] Move NSAttributedStringDocumentAttributes.HyphenationFator to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:14 +01:00
Rolf Bjarne Kvinge 01f770c24d [Foundation] Move NSAttributedStringDocumentAttributes.BackgroundColor to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 0392e9803f [Foundation] Move NSAttributedStringDocumentAttributes.ReadOnly to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.

Also make the property nullable for macOS and XAMCORE_5_0.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 22a8aae9e0 [Foundation] Move NSAttributedStringDocumentAttributes.ViewMode to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge cb12b9ebb9 [Foundation] Move NSAttributedStringDocumentAttributes.ViewZoom to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 82126c0ed2 [Foundation] Move NSAttributedStringDocumentAttributes.ViewSize to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 40c3b428ec [Foundation] Move NSAttributedStringDocumentAttributes.PaperMargin to shared code. 2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 3aa180c2ae [Foundation] Move NSAttributedStringDocumentAttributes.PaperSize to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 947855e1eb [Foundation] Unify NSAttributedStringDocumentAttributes.WeakDefaultAttributes.
The iOS code uses the NSDefaultAttributesDocumentAttribute key, while the macOS code
uses the NSDefaultAttributesDocumentOption key, but according to Apple's documentation
these keys have the same underlying string value, so just use NSDefaultAttributesDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 4d695bd1df [Foundation] Move NSAttributedStringDocumentAttributes.ReadAccessUrl to shared code. 2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 235c9afe45 [Foundation] Unify NSAttributedStringDocumentAttributes.DocumentType.
The iOS code uses the NSDocumentTypeDocumentAttribute key, while the macOS code uses
the NSDocumentTypeDocumentOption key, but according to Apple's documentation these
keys have the same underlying string value, so just use NSDocumentTypeDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 41f1541650 [Foundation] Unify NSAttributedStringDocumentAttributes.WeakDocumentType.
The iOS code uses the NSDocumentTypeDocumentAttribute key, while the macOS code uses
the NSDocumentTypeDocumentOption key, but according to Apple's documentation these
keys have the same underlying string value, so just use NSDocumentTypeDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 5bed159c0b [Foundation] Unify NSAttributedStringDocumentAttributes.StringEncoding.
The iOS code uses the NSCharacterEncodingDocumentAttribute key, while the macOS code
uses the NSCharacterEncodingDocumentOption key, but according to Apple's documentation
these keys have the same underlying string value, so just use NSCharacterEncodingDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 8f03d49a59 [Foundation] Start unifying the source code for NSAttributedStringDocumentAttributes.
Constructors first!
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge d52fd8ddc8
[tests] Assert that we don't have any private IntPtr constructors in cecil-tests. (#17055) 2022-12-15 13:13:21 +01:00
VS MobileTools Engineering Service 2 811cc469f3
[main] Fix WatchKit stub copy error when using native watchOS app (#17048)
Modified the FindWatchOS2AppBundleTaskBase and Xamarin.iOS.Common.targets so that it only tries to copy the WatchKit stub into the IPA file if the watch app bundle includes the folder.

This should fix the error that was found in #10070 by @ivanicin 

Backport of #17004

Co-authored-by: Jack Butler <jbutler@glneurotech.com>
Co-authored-by: Jack Aardal <jaardal@glneurotech.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-12-15 11:08:49 +01:00
Rolf Bjarne Kvinge 1c0f4e9c3c
[Network] Fix constructors in NWPathMonitor. (#16977)
* Call _SetUpdatedSnapshotHandler from the (NativeHandle, bool) constructor,
  this way it's called from all constructors.
* Call the (NativeHandle, bool) constructor from all other constructors to
  ensure a consistent instance.
* Remove the internal (IntPtr) constructor, it's no longer used. This also
  fixes a memory leak, because the (IntPtr) constructor would just create a
  new nw_path_monitor instance instead of using the passed-in handle
  (effectively forgetting about it and leaking it).
2022-12-15 08:03:20 +01:00
Rolf Bjarne Kvinge b78b328e9c
[src] Remove a lot of redundant availability attributes. (#17024)
Remove a lot of redundant availability attributes when the version is lower or equal
to the lowest we support.
2022-12-14 22:36:09 +01:00
Rolf Bjarne Kvinge ffad05b9a3
[tests] Use .NET to build cecil-tests. (#17028)
Use .NET to build cecil-tests, using the appropriate verbosity, and creating a
binlog as well.
2022-12-14 22:35:50 +01:00
Rolf Bjarne Kvinge 4a819741f6
[tests] Parameterize the min OS version in a few mtouch tests. (#17035) 2022-12-14 21:44:36 +01:00
Rolf Bjarne Kvinge 7fd33cce1b
[dotnet] Cache the AOT compiler path. Fixes #16774. (#17033)
Cache the AOT compiler path, to avoid an expensive recomputation on every
build. This is even more expensive when building remotely from Windows, so
store the cached value on Windows.

Fixes https://github.com/xamarin/xamarin-macios/issues/16774.
2022-12-14 18:23:43 +01:00
Steve Hawley e17bd9d64f
[dotnet] First change for blitability of pinvokes with strings (#17032)
This is the first in a series or changes for making pinvokes that take
strings contain all blitable types.

NativeString.cs is being used to do the conversion. Be aware that we're
abusing `IDisposable` to act like C++'s RAII, but it makes the usage
cleaner.
2022-12-14 11:10:14 -05:00
Rolf Bjarne Kvinge 8c6155d617
Bump API references to the Xcode 14.1 release. (#16710) 2022-12-14 09:52:40 +01:00
Rolf Bjarne Kvinge e3f549fc7e
[tests] Improve cecil-tests's member filtering API. (#17001)
* Improve these methods to find members inside nested types as well.
* Simplify their implementation somewhat.
* Make the filter method optional to allow enumerating everything.
* Rename these methods to Enumerate* to better express what they do.
* Make them extension methods on AssemblyDefinition to make them more
  discoverable and easier to use.
2022-12-13 17:09:45 +01:00
Steve Hawley b8f15a0656
[dotnet] handle arrays to make blittable (#17016)
manual marshaling arrays for blitability
2022-12-13 09:40:09 -05:00
Rolf Bjarne Kvinge 081505b173
[tests] Improve perf in cecil-tests by only loading assemblies once. (#16997)
Improve perf in cecil-tests by caching loaded assemblies, and thus only
loading them once. The gain isn't all that much - it saves about 3s of ~2m on
my machine, so ~1.5% faster - but it'll be more and more important as we write
more tests. Also the code becomes slightly simpler too.
2022-12-13 09:23:25 +01:00
Rolf Bjarne Kvinge fd511c7e17
[actions] Fix newlines in changelog generation. (#17023)
We don't need to escape newlines in the changelog message anymore, since it's
not a json-formatted string anymore, it's just plain text.
2022-12-12 21:05:13 +01:00
Reid Kirkpatrick c5cb3cc9db
[CoreMidi] Fixed MidiPacket.Bytes IndexOutOfRangeException. Fixes #16979. (#16992)
Closes #16979

The only `MidiPacket` constructor ever used internally is the one accepting an `IntPtr` argument. Therefore `bytes` will always have the default empty array value. Because of this, in the `Bytes` get accessor `bytes` is not null, but empty and indexing into `bytes` on line 848 throws the exception. The other option would have been to remove the empty array default value that was added in #15098, but the length check seemed like the safer, although maybe slightly less performant, option.
2022-12-12 19:13:33 +01:00
Rolf Bjarne Kvinge a3c157efa4
[Foundation] Handle re-entrancy in NSObject_Disposer.Drain. Fixes #16587. (#17014)
NSObject_Disposer.Drain isn't reentry-safe, and there's a rather impressive
(and not in a good way) case where this can happen: if a native dealloc method
ends up processing the main thread's runloop somehow.

The fix makes the Drain function detect reentrancy, and just re-schedule a
call to itself on the run loop. I believe should be safe - either the dealloc
method will process the runloop again a few times, in which case we'll just
re-schedule the drain call every time, until the dealloc method finishes
processing the runloop, and then the next drain call will actually drain.

Fixes https://github.com/xamarin/xamarin-macios/issues/16587.
2022-12-12 17:41:50 +01:00
Rolf Bjarne Kvinge 0ba8d7e0e2
[tests] Fix potential NullReferenceException in cecil-tests. (#16998)
Fixes this compiler warning:

    tests/cecil-tests/MarshalAsTest.cs(91,8): warning CS8602: Dereference of a possibly null reference.
2022-12-12 17:14:29 +01:00
Rolf Bjarne Kvinge 3ff320805b
[tests] Enable nullability for numerous files in the .NET tests. (#16976) 2022-12-12 17:13:02 +01:00
Rolf Bjarne Kvinge 85b4b791a2
[dotnet] Fix line endings in template localizations. (#16981)
The automatic translation apparently runs on windows, creates files with crlf,
and will check in the corresponding files as such. During the local build
these files will be read and written out again, but now with lf endings,
leaving all these files modified.

So set the 'text' git attribute for these files, so that they're stored as
'lf' and converted to 'crlf' on Windows.
2022-12-12 17:12:35 +01:00
Rolf Bjarne Kvinge 697a571a68
[Foundation] Fix availability attributes to be the same for all platforms. (#17002)
Don't put availability attributes inside a platform condition, because we need
all availability attributes to be visible when building all platforms,
otherwise we won't generate the correct attributes for other platforms.
2022-12-12 17:09:59 +01:00
dependabot[bot] 1db1f48698
Bump peterjgrainger/action-create-branch from 2.3.0 to 2.4.0 (#16960) 2022-12-12 15:30:34 +01:00
Rolf Bjarne Kvinge 660ff60ad5
[tests] Improve performance a bit in Cecil.Tests.GenericPInvokesTest. (#16999)
Improve performance in Cecil.Tests.GenericPInvokesTest by creating fewer
strings.

This saves about 1m07s seconds on my machine, from 2m10s to 1m03s, so ~52%
faster.
2022-12-12 15:29:47 +01:00
Rolf Bjarne Kvinge dc37be300e
Remove bitcode-related code, since bitcode is dead. (#16986) 2022-12-12 15:25:37 +01:00
dotnet-maestro[bot] a26994a250
[main] Update dependencies from dotnet/runtime (#16994)
This pull request updates the following dependencies

## From https://github.com/dotnet/runtime
- **Subscription**: 38d2313f-22d5-4062-c8e1-08dabd6d8c77
- **Build**: 20221206.4
- **Date Produced**: December 7, 2022 12:38:15 AM UTC
- **Commit**: 8ac3832812f9bc37fba2a66ac8987ca66d381d85
- **Branch**: refs/heads/release/7.0

- **Updates**:
  - **Microsoft.NETCore.App.Ref**: [from 7.0.2 to 7.0.2][5]

[5]: 4f15a5c...8ac3832

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2022-12-12 11:26:10 +01:00
dotnet-maestro[bot] 9092a5ade7
[main] Update dependencies from dotnet/installer (#17007)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer
- **Subscription**: 50c9492e-4671-4d1d-7920-08dabd1031a2
- **Build**: 20221209.1
- **Date Produced**: December 9, 2022 4:28:09 PM UTC
- **Commit**: 3c4322d8e5f92a3a2a2d51095c2f06bb1c033b88
- **Branch**: refs/heads/release/7.0.1xx

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 7.0.102-servicing.22601.12 to 7.0.102-servicing.22609.1][2]

[2]: de57a6e...3c4322d

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <github-actions@xamarin.com>
2022-12-12 11:24:12 +01:00
Rolf Bjarne Kvinge 7d6e45f942
[src] Fix a few issues in some availability attributes. (#17003)
* There's no such thing as Mac Catalyst 8.0. This is probably copied from iOS 8.0,
  which is supported in all versions of Mac Catalyst, so just remove the version
  for the corresponding SupportedOSPlatform attributes.
* Remove the version in SupportedOSPlatform attributes when the version is equal
  to or lower than the min OS version we support for the given platform.
* Remove UnsupportedOSPlatform attributes when there's an identical ObsoletedOSPlatform
  attribute.
* Remove UnsupportedOSPlatform attributes when it's a blatent lie, because the
  API is available (in Security/Certificate.cs).
* There's no such thing as Mac Catalyst 10.13. It looks like this was a typo, meant
  to be Mac Catalyst 13.0.
2022-12-12 10:44:27 +01:00
Rolf Bjarne Kvinge 073e4ef7c4
[src] Parameterize the min OS versions when generating MinimumVersions.cs (#16984) 2022-12-12 10:43:48 +01:00
Rolf Bjarne Kvinge cc5c1bb4bf
[tests] Adjust cecil-tests to not test 32-bit iOS assemblies unless 32-bit iOS architectures are enabled. (#16989) 2022-12-07 18:24:14 +01:00
Rolf Bjarne Kvinge 1031928ae1
[tools] Enable nullability in MachO.cs (#16982) 2022-12-07 18:07:53 +01:00
Rolf Bjarne Kvinge d17191f9c3
[xharness] Parameterize the min OS version for generated projects. (#16985) 2022-12-07 17:43:52 +01:00
Rolf Bjarne Kvinge 0e0a71aa5d
[tools] Enable nullability in SdkVersions.cs (#16983) 2022-12-07 17:43:28 +01:00
Rolf Bjarne Kvinge cb28b21189
[tools/src] Enable nullability in a few error-related source files. (#16987) 2022-12-07 17:43:05 +01:00
Rolf Bjarne Kvinge 78813cb591
[tests] Remove some dead code. (#16988) 2022-12-07 17:42:36 +01:00
Rolf Bjarne Kvinge 7f2d7dcce5
[tests] We don't want exceptions to the obsolete test to apply anymore in XAMCORE_5_0 in cecil-tests. (#16991)
That's the time to fix those exceptions.
2022-12-07 17:42:11 +01:00
Rolf Bjarne Kvinge 25fc6c84d1
[dotnet-linker] Handle null fields in BackingFieldDelayHandler as unmarked fields. Fixes #16957. (#16970)
The BackingFieldDelayHandler will temporarily remove the body of Dispose
methods, and then for every field accessed in the Dispose method that was
preserved by the linker, we'll keep the corresponding code in the Dispose
method (otherwise we'd remove the code).

This is a way to remove fields that are _only_ accessed (and nulled out) in
the Dispose method.

However, we were running into a problem with determining if a field was marked
by the linker: if the field is in a generic type, and that field was not
marked by the linker, the linker might have actually removed the field from
the containing type before we're processing the Dispose methods, and we'd find
a null field definition where no null field definition was expected
(eventually resulting in an ArgumentNullException).

Fix this by treating a null field definition as an unmarked field.

Also add a test.

Fixes https://github.com/xamarin/xamarin-macios/issues/16957.
2022-12-07 15:53:15 +01:00
Rolf Bjarne Kvinge 6581fcb5fb
[Foundation] Create a new NSAttributedStringDocumentAttributeKey enum to match Apple's headers. (#16969)
This allows us to unify the code between all platforms.

Also add all the NSAttributedStringDocumentAttributeKey values we haven't bound yet.

There are no changes in the public API, because I'm only changing internal types.

Ref: #14489.
2022-12-07 15:52:20 +01:00
Rolf Bjarne Kvinge 294314a518
[autoformat] Add the rest of the repository. (#16974) 2022-12-07 09:13:36 +01:00