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

15173 Коммитов

Автор SHA1 Сообщение Дата
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
Dean Ellis 669070c6ad
[perf] Update Delete Task to use DeleteFilesAsync. (#16929) 2022-12-07 07:57:39 +01:00
Rolf Bjarne Kvinge 6de952131d
[autoformat] Update some new code. (#16971)
This is code from PRs that were started before we started autoformatting the
files in question, and then merged afterwards.
2022-12-07 07:45:54 +01:00
Steve Hawley 3c512a8331
[net8.0] added a test for blittability of pinvokes, partial #15684 (#16525)
This adds a unit test to check for blittability of arguments to
pinvokes.
2022-12-06 14:35:16 -05:00
Rolf Bjarne Kvinge 407b4c4ac6
[tests] Add logic to detect when macOS and Mac Catalyst test apps don't launch properly. Fixes #xamarin/maccore@2414. (#16946)
Implement a launch timeout for macOS and Mac Catalyst apps where if a certain
environment variable (LAUNCH_SENTINEL_FILE) is set, the app will create that
file at launch. The code launching the test app will wait 10 seconds and check
if the file is there: if it's not, something went wrong, in which case the app
should be terminated and launched again.

This necessitated re-implementing the launch script in C#, since it got quite
complicated to implement in bash.

This fixes an issue with Mac Catalyst apps where something would go wrong
during the app launch and nothing would happen (but the app wouldn't be
deadlocked, it would just sit there, doing nothing).

The TestRuntime.cs and ApplePlatform.cs had to be added to a few test projects
to make this compile, which required a few fixes in these files for building
with legacy Xamarin.Mac.

Fixes https://github.com/xamarin/maccore/issues/2414.
2022-12-06 13:11:36 +01:00
Jeffrey Stedfast 1075c66d95
Fix typo in iOS Storyboard template (#16966)
Partial fix for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1694105

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-12-06 13:00:28 +01:00
Manuel de la Pena ccb5c435a1
[Foundation] Add nullability to NSFormatter. Fixes #16924 (#16925)
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-12-06 11:08:28 +01:00
Rolf Bjarne Kvinge aa5444ff2b
[autoformat] Add all of src/. (#16958) 2022-12-06 11:07:43 +01:00
Rolf Bjarne Kvinge 0a9260dbb5
[actions] Fix parsing problem in the changelog action. (#16940)
Fixes this:

    SyntaxError: Unexpected identifier
        at new AsyncFunction (<anonymous>)
    Error: Unhandled error: SyntaxError: Unexpected identifier
        at callAsyncFunction (/home/runner/work/_actions/actions/github-script/v6.3.3/dist/index.js:13356:16)
        at main (/home/runner/work/_actions/actions/github-script/v6.3.3/dist/index.js:13452:26)
        at Module.858 (/home/runner/work/_actions/actions/github-script/v6.3.3/dist/index.js:13429:1)
        at __webpack_require__ (/home/runner/work/_actions/actions/github-script/v6.3.3/dist/index.js:24:31)
        at startup (/home/runner/work/_actions/actions/github-script/v6.3.3/dist/index.js:43:19)
        at /home/runner/work/_actions/actions/github-script/v6.3.3/dist/index.js:49:18
        at Object.<anonymous> (/home/runner/work/_actions/actions/github-script/v6.3.3/dist/index.js:52:10)
        at Module._compile (node:internal/modules/cjs/loader:1101:14)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

by not storing the changelog entry in an environment variable between tasks,
but instead store it on disk.
2022-12-06 07:50:31 +01:00
Rolf Bjarne Kvinge 94bdee0d7c
[autoformat] Update some new code. (#16967)
This is code from PRs that were started before we started autoformatting
the files in question, and then merged afterwards.
2022-12-06 07:49:52 +01:00
Rolf Bjarne Kvinge 36125e3b3f
[tests] Ignore the MonoTests.System.TimeZoneInfoTest+IsDaylightSavingTimeTests.Bug_16395 test. Fixes #xamarin/maccore@2629. (#16956)
It looks like some timezone data has changed, so this test is now failing.
Mono will probably not be updated, so just ignore the test.

Fixes https://github.com/xamarin/maccore/issues/2629.
2022-12-05 22:31:16 +01:00
Rolf Bjarne Kvinge 966933de8c
[Foundation] Create a new NSAttributedStringDocument type to match Apple's headers. (#16952)
This also allows us to unify the code between all platforms.

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

Ref: #14489.
2022-12-05 22:30:59 +01:00
VS MobileTools Engineering Service 2 a201c4b3af
Localized file check-in by OneLocBuild Task: Build definition ID 17751: Build ID 7046351 (#16955)
This is the pull request automatically created by the OneLocBuild task
in the build process to check-in localized files generated based upon
translation source files (.lcl files) handed-back from the downstream
localization pipeline. If there are issues in translations, visit
https://aka.ms/ceLocBug and log bugs for fixes. The OneLocBuild wiki is
https://aka.ms/onelocbuild and the localization process in general is
documented at https://aka.ms/AllAboutLoc.
2022-12-05 09:10:55 -06:00
Rolf Bjarne Kvinge 13bcd776d3
[Foundation] Improve null-checking in MonoTouchException.AppendNativeStackTrace. (#16928)
Hopefully fixes this problem:

    Unhandled managed exception: Failed to print exception: System.NullReferenceException: Object reference not set to an instance of an object
      at Foundation.MonoTouchException.AppendNativeStackTrace (System.Text.StringBuilder sb) [0x0002f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/Foundation/MonoTouchException.cs:51
      at Foundation.MonoTouchException.get_Message () [0x00039] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/Foundation/MonoTouchException.cs:43
      at ObjCRuntime.Runtime.PrintException (System.Exception exc, System.Boolean isInnerException, System.Text.StringBuilder sb) [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:528
      at ObjCRuntime.Runtime.PrintAllExceptions (System.IntPtr exception_gchandle) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/16.0.0.72/src/Xamarin.iOS/ObjCRuntime/Runtime.cs:545
2022-12-05 09:07:03 +01:00
Rolf Bjarne Kvinge b3cb85c0ad
[tests] Allow for timeouts in CI in a few tests. (#16945)
Also add some exception handling.

Hopefully fixes more issues with broken network in CI.
2022-12-05 08:53:33 +01:00
Rolf Bjarne Kvinge f7533f5ab9
Bump xharness. (#16947) 2022-12-05 08:53:05 +01:00
dotnet-maestro[bot] 796c2360a1
[main] Update dependencies from dotnet/installer (#16948)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer
- **Subscription**: 50c9492e-4671-4d1d-7920-08dabd1031a2
- **Build**: 20221201.12
- **Date Produced**: December 1, 2022 7:29:30 PM UTC
- **Commit**: de57a6e8e4d65a03405f6aac5c0384159bd8fa70
- **Branch**: refs/heads/release/7.0.1xx

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

[3]: ce2f541...de57a6e

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: GitHub Actions <github-actions@xamarin.com>
2022-12-05 08:36:43 +01:00
Rolf Bjarne Kvinge 1c80823582
[autoformat] Add all of tests/. (#16857) 2022-12-05 08:23:34 +01:00