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

6849 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge c8fc59a488 Merge remote-tracking branch 'origin/main' into bump-main-in-net9.0-2024-02-19 2024-02-28 18:00:53 +01:00
Rolf Bjarne Kvinge 05b3b9470b Merge remote-tracking branch 'origin/main' into bump-main-in-net9.0-2024-02-19 2024-02-28 17:58:39 +01:00
Rolf Bjarne Kvinge b17de38d2d Merge remote-tracking branch 'origin/main' into bump-main-in-net9.0-2024-02-19 2024-02-28 17:56:05 +01:00
Rolf Bjarne Kvinge 244f6aa9ac Merge remote-tracking branch 'origin/main' into bump-main-in-net9.0-2024-02-19 2024-02-28 17:54:47 +01:00
Rolf Bjarne Kvinge 53bea22454 Merge remote-tracking branch 'origin/main' into bump-main-in-net9.0-2024-02-19 2024-02-28 17:50:00 +01:00
Rolf Bjarne Kvinge c303a9c7c7
[dotnet] Multi target with Xcode 15.0 (#20155)
Add multi-targeting support for our initial .NET 8 packs (for Xcode
15.0).

This means a library/binding project can do:

```xml
<TargetFrameworks>net8.0-ios17.0;net8.0-ios17.2</TargetFrameworks>
```

and the library will be built in two varieties: once using our iOS 17.0
bindings, and once using our iOS 17.2 bindings.

An app project can also do:

```xml
<TargetFramework>net8.0-ios17.0</TargetFramework>
```

to build with the iOS 17.0 bindings (which is typically not very useful,
since building with the latest iOS SDK is usually best).
2024-02-28 09:03:53 +01:00
Rolf Bjarne Kvinge ffb3041720
[src] Disable a few code paths on macOS if dynamic registration is disabled. (#20178)
This makes the linker able to trim away a few methods that aren't trim-safe
when using the managed static registrar (and thus not warn about these methods
doing un-trimmable stuff).

Contributes towards #10405.
2024-02-28 09:01:24 +01:00
Rolf Bjarne Kvinge 90992e464b
[CoreGraphics] Make P/Invokes in CGContext have blittable signatures. (#20207)
Contributes towards #15684.
2024-02-28 08:59:24 +01:00
Rolf Bjarne Kvinge 69bb4ac1fb
[CoreGraphics] Make P/Invokes in CGColorSpace have blittable signatures. (#20202)
Contributes towards #15684.
2024-02-27 11:33:40 +01:00
Haritha Mohan 4409a06e73
[dotnet] Fix sourcelink test failure (#20205)
Follow up to https://github.com/xamarin/xamarin-macios/pull/20054
2024-02-27 08:28:34 +01:00
Haritha Mohan 297f12d141
[dotnet] add sourcelink support (#20054)
Fixes https://github.com/xamarin/xamarin-macios/issues/18968

We provide a mapping to the checked in source files via SourceLink.json
and the rest of the generated/untracked sources are embedded into the
PDB to provide a more comprehensive debugging experience. Since we
invoke CSC directly, there were a few workarounds that had to be
implemented (ex: implementing a helper script to account for untracked
sources instead of simply using the EmbedUntrackedSources MSBuild
property).

As for testing, the newly added support was validated via the dotnet
sourcelink tool which confirmed all the sources in the PDB either had
valid urls or were embedded.

`sourcelink test Microsoft.MacCatalyst.pdb` —> `sourcelink test passed:
Microsoft.MacCatalyst.pdb`

The PDB size does increase in size after embedding;
Microsoft.MacCatalyst.pdb went from 5 MB to 15.7 MB.

But considering it would significantly help improve the debugging
experience, be consistent with Android’s offerings, and it’s a
highlighted attribute on the NuGet package explorer I think it’s a
worthy size increase.

Refs:
https://github.com/xamarin/xamarin-android/pull/7298 
https://github.com/dotnet/roslyn/issues/12625
https://github.com/dotnet/sourcelink/tree/main/docs

---------

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Michael Cummings (MSFT) <mcumming@microsoft.com>
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2024-02-26 08:10:26 -08:00
Rolf Bjarne Kvinge 78ae4b0686
[AudioUnit] Make P/Invokes in AudioComponent.cs have blittable signatures. (#20146)
Contributes towards #15684.
2024-02-26 12:16:17 +01:00
Rolf Bjarne Kvinge 4ec79f3ba4
[CoreFoundation] Make remaining P/Invokes have blittable signatures. (#20166)
Contributes towards #15684.
2024-02-23 11:48:52 +01:00
Rolf Bjarne Kvinge 75b6a5109e Merge remote-tracking branch 'origin/net9.0' into bump-main-in-net9.0-2024-02-19 2024-02-23 10:37:34 +01:00
Rolf Bjarne Kvinge 75a04ec0cc
[CoreFoundation] Make P/Invokes in CFStream have blittable signatures. (#20163)
Contributes towards #15684.
2024-02-22 18:53:07 +01:00
Rolf Bjarne Kvinge fe695d30bd
[CoreFoundation] Make P/Invokes in CFNetwork have blittable signatures. (#20161)
Contributes towards #15684.
2024-02-22 18:00:01 +01:00
Rolf Bjarne Kvinge 70368f2cb0
[msbuild] Move all tasks from Xamarin.[iOS|Mac].Tasks into Xamarin.MacDev.Tasks. (#20118)
After this the Xamarin.iOS.Tasks and Xamarin.Mac.Tasks assemblies are empty,
so the next step will be to remove them completely (this will happen in a
different pull request).

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
2024-02-22 16:34:17 +01:00
Rolf Bjarne Kvinge c30f099659
[tests] Define NATIVEAOT in our common csproj file instead of xharness when building with NativeAOT. (#19914)
This avoids problems when building and running test suites from the command
line (we'll use the same defines as in xharness).

Some changes in xharness were needed in order to set the
PublishAot/_IsPublishing properties early enough.
2024-02-22 09:23:49 +01:00
Rolf Bjarne Kvinge a231083ae5
[CoreFoundation] Make P/Invokes in CFSocket have blittable signatures. (#20162)
Contributes towards #15684.
2024-02-22 09:17:25 +01:00
Rolf Bjarne Kvinge dbbf9c3d86
[runtime] Don't register Runtime.CreateDelegateProxy when using the managed static registrar. (#20164)
It'll never be called from the generated code from the managed static
registrar, so there's no need to register it as a potential callback from
native code.

This makes the linker able to remove the Runtime.CreateDelegateProxy method
(and a few other methods as well) when using the managed static registrar (and
thus not warn about these methods doing un-trimmable stuff).

Contributes towards #10405.
2024-02-22 08:51:34 +01:00
Rolf Bjarne Kvinge 64d7a2076c
[CoreFoundation] Fix CFWriteStream.DoGetProperty to actually get the property. (#20158)
Ref: aa13dcb506

First line in the description is:

> Fixed CFWriteStream.DoGetProperty to call CFWriteStreamCopyProperty (and not CFReadStreamCopyProperty)

But that's not what the actual change does.. so change it to do the right thing.
2024-02-22 08:51:10 +01:00
Rolf Bjarne Kvinge 89c7f07546
[CoreFoundation] Make P/Invokes in CFMessagePort have blittable signatures. (#20160)
Contributes towards #15684.
2024-02-22 08:49:05 +01:00
Rolf Bjarne Kvinge b099691015
[introspection] Fix calling base in iOSApiCtorInitTest.SkipCheckShouldReExposeBaseCtor. (#20154)
The Skip* overrides in introspection are of the type "Do we skip? If not, then
I don't know, and we should call base", but the implementation of
iOSApiCtorInitTest.SkipCheckShouldReExposeBaseCtor is wrong, it just says to
not skip for every type except the one the method knows about.

So adjust the logic to call base if
iOSApiCtorInitTest.SkipCheckShouldReExposeBaseCtor has no knowledge of the
type in question.
2024-02-21 10:41:28 +01:00
Rolf Bjarne Kvinge 79ac366c8f
[Foundation] Don't leak exceptions in WrappedNSInputStream.Read. (#20131)
We don't want to leak exceptions back to the calling native code in WrappedNSInputStream.Read, because that will likely crash the process.

Example stack trace:

    ObjectDisposed_StreamClosed (System.ObjectDisposedException)
       at System.ThrowHelper.ThrowObjectDisposedException_StreamClosed(String) + 0x3c
       at System.IO.MemoryStream.Read(Byte[], Int32, Int32) + 0x124
       at System.Net.Http.MultipartContent.ContentReadStream.Read(Byte[], Int32, Int32) + 0x78
       at System.Net.Http.NSUrlSessionHandler.WrappedNSInputStream.Read(IntPtr buffer, UIntPtr len) + 0x58
       at MyApp!<BaseAddress>+0x7082f8

Instead return -1 from the Read method, which is documented as an error
condition, and then also return a custom NSError from the Error property -
which is also documented to be where the error is supposed to be surfaced.

Ref: https://developer.apple.com/documentation/foundation/nsinputstream/1411544-read

Ref: https://github.com/xamarin/xamarin-macios/issues/20123.
2024-02-21 10:29:33 +01:00
Rolf Bjarne Kvinge 16be59f7d6
[dotnet] Show a better error when using a .NET framework version we don't support. (#20142)
If a project tried to use a .NET 6 project (say TargetFramework=net6.0-ios), then
we used to show these rather unhelpful errors:

    error NETSDK1147: To build this project, the following workloads must be installed: wasm-tools-net6
    error NETSDK1147: To install these workloads, run the following command: dotnet workload restore

The underlying problem is that we don't support .NET 6 anymore, so with this fix we now show:

    error NETSDK1202: The workload 'net6.0-ios' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy.

which is much more helpful.

References:

* https://github.com/dotnet/sdk/pull/32426
* https://github.com/xamarin/xamarin-android/pull/8047

Fixes https://github.com/xamarin/xamarin-macios/issues/18790.
2024-02-21 10:07:09 +01:00
Rolf Bjarne Kvinge fa0db16209
[AddressBook] Make P/Invokes have blittable signatures. (#20145)
Contributes towards #15684.
2024-02-20 16:47:23 +01:00
Rolf Bjarne Kvinge b1cd69220f
[runtime] Don't register Runtime.GetGenericMethodFromToken when the managed static registrar is used. (#20144)
It'll never be called from the generated code from the managed static
registrar, so there's no need to register it as a potential callback from
native code.

This makes the linker able to remove the Runtime.GetGenericMethodFromToken
method (and a few other methods as well).

Contributes towards #10405.
2024-02-20 16:47:13 +01:00
Rolf Bjarne Kvinge 59287e90bf
[tests] Collect info about installed XMA build agents to try to track down an installation failure. (#20134)
Collect info to try to track down this random failure:

	[...]
    [xma][info]: Uploaded Build.zip 100%
    [xma][info]: Successfully copied /tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip
    [xma][info]: Checking integrity of uploaded file /tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip...
    [xma][info]: Executing SSH command: '/usr/bin/shasum -a 256 "/tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip" | awk "{ print $1 }"'
    [xma][info]: Trying to copy to '/tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip' to cache...
    [xma][info]: Executing SSH command: 'mkdir -p "/Users/builder/Library/Caches/Xamarin/XMA/Cache"'
    [xma][info]: Executing SSH command: 'cp -f "/tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip" "/Users/builder/Library/Caches/Xamarin/XMA/Cache/c3cbbdd25de4805022ca502605de17757ace8ffd3d5458dec1142c1f88211587"'
    [xma][info]: Successfully copied '/tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip' to cache
    [xma][info]: Unzipping file '/tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip' to '/Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8'
    [xma][info]: Executing SSH command: 'ls "/Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8"'
    [xma][info]: Creating directory '/Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8' for installation...
    [xma][info]: Executing SSH command: 'mkdir -p "/Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8"'
    [xma][info]: Executing SSH command: 'unzip -o "/tmp/Build-1.13.0.8-992eab55-04bf-44f3-b12d-df4b6ec5efb7/Build.zip" -d "/Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8"'
    [xma][info]: Executing SSH command: 'ls "/Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8"'
    [xma][info]: Executing SSH command: 'find "/Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8/" -type f | while read line ; do /usr/bin/shasum -a 256 "$line" | awk "{ print $1 }" ; done'
    [xma][warn]: Integrity check failed between source and target content. Source path: d:\azdo\_work\1\s\xamarin-macios\tests\dotnet\windows\bin\dotnet\packs\Microsoft.iOS.Windows.Sdk\17.2.8172-ci.main\tools\msbuild\iOS\Build.zip, Target path: /Users/builder/Library/Caches/Xamarin/XMA/Agents/Build/1.13.0.8
    [xma][err]: Unable to install the Agent 'Build 1.13.0.8'
    [xma][info]: An error occurred while trying to start the Build Agent. Details: Unable to install the Agent 'Build 1.13.0.8'
    exception: An error occurred while installing Build 1.13.0.8
2024-02-20 16:47:02 +01:00
Rolf Bjarne Kvinge dd363191cc
[dotnet-linker] Add ProcessExportedFields to the list of steps we execute. Fixes #20061. (#20066)
Fixes https://github.com/xamarin/xamarin-macios/issues/20061.
2024-02-20 16:46:47 +01:00
Rolf Bjarne Kvinge 0cdeeb1fb0
[ModelIO] Make P/Invokes have blittable signatures. (#20153) 2024-02-20 16:46:34 +01:00
Rolf Bjarne Kvinge d37c04915f
[net9.0] [tests] Add a test to verify that we can build .NET 8 apps. (#19897) 2024-02-20 09:21:59 +01:00
Rolf Bjarne Kvinge 1bc66d0ebe Update warning text. 2024-02-19 18:51:32 +01:00
Rolf Bjarne Kvinge 3c0ffac0ee
[tests] Unignore the BuildNet7_0App test. Fixes #18655. (#19768)
Fixes https://github.com/xamarin/xamarin-macios/issues/18655.
2024-02-19 17:54:20 +01:00
Rolf Bjarne Kvinge f0050b1f83
[dotnet] Disable support for custom runtime hosting. (#20128)
We don't need it, and it causes a trimmer warning.
2024-02-19 14:22:04 +01:00
Rolf Bjarne Kvinge e9366bdf8b [net9.0] Merge main into net9.0. 2024-02-19 14:11:20 +01:00
Manuel de la Pena af6a63949a
[Tests] Fix trim warnings tests (#20132)
Two changes:

1. Fix the tests by not using the Configuration.SourceRoot property. There is a bug in that code that returns diff paths in some bots.
2. Use Assert.Multiple for better error formatting.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2024-02-18 10:05:31 -05:00
Rolf Bjarne Kvinge da2525b7fb
[tests] Add test to keep track of trimmer warnings. (#20125)
Add test to keep track of trimmer warnings and to make sure we don't accidentally
introduce new ones.

Ref: https://github.com/xamarin/xamarin-macios/issues/10405
2024-02-16 16:53:12 +01:00
Rolf Bjarne Kvinge f392bbd3b2
[Accessibility] Make P/Invokes have blittable signatures. (#20124)
Contributes towards #15684.

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
2024-02-16 16:52:39 +01:00
Rolf Bjarne Kvinge 4cb499e256
[MediaAccessibility] Make P/Invokes have blittable signatures. (#20120)
Contributes towards #15684.
2024-02-16 13:26:05 +01:00
Rolf Bjarne Kvinge f7f53b741b
[tests] Verify that we have a remote connection in tests that require a remote connection. (#20114)
By default, the build will just continue if a remote connection couldn't be
established. For tests that require a remote connection, this often results in
weird errors later on in the build, so improve this by immediately verifying
that we were able to establish a remote connection and telling the developer
where to look for more information.

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
2024-02-16 10:41:52 +01:00
Rolf Bjarne Kvinge dc90060cfa
[devops] Split monotouch-test by platform as well. (#19988) 2024-02-14 09:26:34 +01:00
Rolf Bjarne Kvinge 10f2681abd
[msbuild] Use MetadataLoadContext in the UnpackLibraryResources task. (#20017)
This avoids the Mono.Cecil dependency, and also MetadataLoadContext is both
faster and better maintained.

A temporary downside is that all the reference assemblies will have to be
copied to the remote Mac for remote builds, but this will be fixed in a future
change where we'll execute this task mostly locally on Windows, and we'll
only copy the unpacked resources to the Mac.
2024-02-13 16:40:58 +01:00
dotnet-maestro[bot] 5c77e3321c
[net9.0] Update dependencies from dotnet/installer (#20046)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer

- **Subscription**: 3727984b-7a79-4ba3-37dd-08dbe6bddf31
- **Build**: 20240212.1
- **Date Produced**: February 12, 2024 11:18:24 AM UTC
- **Commit**: ab44b49a395ac6a524628cdd8c5d99614248c584
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 9.0.100-preview.2.24103.2 to 9.0.100-preview.2.24112.1][12]
  - **Microsoft.NET.ILLink.Tasks**: [from 9.0.0-preview.2.24080.1 to 9.0.0-preview.2.24109.4][13]
  - **Microsoft.AspNetCore.App.Ref**: [from 9.0.0-preview.2.24079.10 to 9.0.0-preview.2.24109.2][14]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.2.24080.1 to 9.0.0-preview.2.24109.4][13]
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: [from 9.0.0-preview.2.24076.1 to 9.0.0-preview.2.24105.1][15]
  - **Microsoft.NETCore.App.Ref**: [from 9.0.0-preview.2.24080.1 to 9.0.0-preview.2.24109.4][13]

[12]: 3210d5ad3b...ab44b49a39
[13]: d40c654c27...a79c62ddc8
[14]: 70abdab0a5...4deb60bb65
[15]: 687be2a32a...329f74da67

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 9.0.0-preview.2.24080.1 to 9.0.0-preview.2.24109.4 (parent: Microsoft.Dotnet.Sdk.Internal)
  - **Microsoft.AspNetCore.App.Ref**: from 9.0.0-preview.2.24079.10 to 9.0.0-preview.2.24109.2 (parent: Microsoft.Dotnet.Sdk.Internal)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.2.24080.1 to 9.0.0-preview.2.24109.4 (parent: Microsoft.Dotnet.Sdk.Internal)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: from 9.0.0-preview.2.24076.1 to 9.0.0-preview.2.24105.1 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-preview.2.24080.1 to 9.0.0-preview.2.24109.4 (parent: Microsoft.Dotnet.Sdk.Internal)
2024-02-13 12:39:32 +01:00
Rolf Bjarne Kvinge 72afc648c3
[UIKit] Remove presnippet for UITextView.TypingAttributes. Fixes #12709. (#20089)
Apparently, in earlier versions of iOS, returning an empty dictionary from
UITextView.TypingAttributes would crash, so we added a workaround where we'd
return null instead of an empty dictionary.

However, I can't reproduce any such crashes anymore, and this workaround is
causing other problems, so remove it.

But do this in a backwards compatible way (just in case the removal ends up
crashing apps after all):

* Add a new TypingAttributes2 binding with the behavior we want (a better name
  wouldn't be unwelcome!)
* Mark the existing TypingAttributes as obsolete, pointing to
  TypingAttributes2.
* Make the TypingAttributes property behave as we want in XAMCORE_5_0, and at
  that point  mark TypingAttributes2 as obsolete and point back to
  TypingAttributes.
* Remove TypingAttributes2 in XAMCORE_6_0.

Note: the presnippet attribute to avoid the crash was introduced in 2013:
5adb7c8608,
and our current minimum iOS version (iOS 11), was launched in 2017, so most
likely (aka hopefully) the crash was fixed in an iOS version earlier than the
earliest we support.

Fixes https://github.com/xamarin/xamarin-macios/issues/12709.
2024-02-13 08:28:11 +01:00
Rolf Bjarne Kvinge d48bd12ff9 [net9.0] Merge main into net9.0. 2024-02-09 17:02:43 +01:00
Rolf Bjarne Kvinge 5d6dc16270
[CoreFoundation] Make P/Invokes in CFBundle and CFDictionary have blittable signatures. (#20060)
Contributes towards #15684.
2024-02-08 17:04:28 +01:00
Rolf Bjarne Kvinge b25691dc5d Merge remote-tracking branch 'origin/net9.0' into bump-main-in-net9.0-2024-01-29 2024-02-07 10:49:57 +01:00
Rolf Bjarne Kvinge ff1e5ee225 Merge remote-tracking branch 'origin/main' into bump-main-in-net9.0-2024-01-29 2024-02-07 10:49:48 +01:00
Rolf Bjarne Kvinge d28223499c
[MobileCoreServices] Make P/Invokes have blittable signatures. (#20015)
Contributes towards #15684
2024-02-06 15:27:39 +01:00
Rolf Bjarne Kvinge cd45f9b8f4
[tests] Add a test case for not modifying app after it's been signed. (#20035)
This is a test case for https://github.com/xamarin/xamarin-macios/issues/19278.

Ref: https://github.com/xamarin/xamarin-macios/issues/19926.
2024-02-06 15:27:11 +01:00