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

17366 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge a72bb30aca
Fix boolean condition to determine whether dynamic code is supported or not. Fixes #dotnet/runtime@101840. (#20563) (#20696)
Dynamic code is not supported if the interpreter is not enabled, and the
interpreter is not enabled if the MtouchInterpreter property is *empty*.

This regression was introduced in #19812.

Fixes https://github.com/dotnet/runtime/issues/101840.
2024-06-07 18:43:17 +02:00
Rolf Bjarne Kvinge 34f58bbed4
[runtime] Use calloc instead of malloc. (#20692)
It's safer, since the returned memory is zero-initialized.

Also add tests.
2024-06-07 16:56:54 +02:00
Rolf Bjarne Kvinge e9d59d5f58
[bgen] Implement support for using default interface members to bind protocols. (#20681)
Given the following API definition:

```cs
[Protocol]
public interface Protocol {
    [Abstract]
    [Export ("requiredMethod")]
    void RequiredMethod ();

    [Export ("optionalMethod")]
    void OptionalMethod ();
}
```

we're now binding it like this:

```cs
[Protocol ("Protocol")]
public interface IProtocol : INativeObject {
    [RequiredMember]
    [Export ("requiredMethod")]
    public void RequiredMethod () { /* default implementation */ }

    [OptionalMember]
    [Export ("optionalMethod")]
    public void OptionalMethod () { /* default implementation */ }
}
```

The main difference from before is that the only difference between required
and optional members is the [RequiredMember]/[OptionalMember] attributes.

This has one major advantage: it's now possible to switch a member from being
required to being optional, or vice versa, without breaking neither source nor
binary compatibility.

It also improves intellisense for optional members. In the past optional
members were implemented using extension methods, which were not very
discoverable when you were supposed to implement a protocol in your own class.

The main downside is that the C# compiler won't enforce developers to
implement required protocol members (which is a necessary side effect of the
fact that we want to be able to switch members between being required and
optional without breaking compatibility). If this turns out to be a problem,
we can implement a custom source analyzer and/or linker step that detects
missing implementations and issue warnings/errors.

This PR also:

* Adds numerous tests.
* Updates the requiredness of a few members in Metal to test that it works as
  expected.
* Adds documentation.
* Handles numerous corner cases, which are documented in code and docs.

This PR is probably best reviewed commit-by-commit.

Fixes https://github.com/xamarin/xamarin-macios/issues/13294.
2024-06-07 16:35:48 +02:00
Milos Kotlar 603781b63f
Enable dedup optimization in FullAOT mode only (#20687)
## Description

This PR enables the dedup optimization in FullAOT mode only. The
optimization can only run in FullAOT mode with complete application
context. Without it, the AOT compiler may fail to collect all generic
instances, and the runtime can't find them as they are searched in the
dedup assembly.

## Changes

This PR updates the SDK targets to enable dedup optimization in FullAOT
mode only. This change doesn't depend on any runtime changes.

## Verification

This PR also introduces partial AOT tests. They inspect the bundle for
`aot-instances.dll`, which shouldn't be generated in a partial AOT
compilation setup. Additionally, basic functionality is tested by
asserting at app startup.

## Additional notes

This change should be backported to .NET 8 as well.

Fixes https://github.com/dotnet/runtime/issues/99248
2024-06-07 13:21:41 +02:00
dotnet-maestro[bot] 7a868d44de
[main] Update dependencies from dotnet/xharness (#20676)
This pull request updates the following dependencies

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

- **Subscription**: 601bc5e1-1cae-44b5-cf5f-08db9342aa2f
- **Build**: 20240527.1
- **Date Produced**: May 27, 2024 1:16:33 PM UTC
- **Commit**: 914dd73b3622741590db173b5dd6eac1aa9cc553
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.DotNet.XHarness.iOS.Shared**: [from 9.0.0-prerelease.24270.4 to 9.0.0-prerelease.24277.1][1]

[1]: 8478d1a9a5...914dd73b36
2024-06-07 11:56:03 +02:00
dotnet-maestro[bot] a5a05ec638
[main] Update dependencies from dotnet/installer (#20694)
This pull request updates the following dependencies

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

- **Subscription**: 80cb9ffd-f92f-4fc8-9f8b-08dbca46abfb
- **Build**: 20240606.1
- **Date Produced**: June 6, 2024 11:23:32 AM UTC
- **Commit**: 0fea32701d3b882cb06b297b86f8443d446f9814
- **Branch**: refs/heads/release/8.0.1xx

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 8.0.107-servicing.24304.13 to 8.0.107-servicing.24306.1][1]

[1]: 91ea047c8b...0fea32701d
2024-06-07 11:39:45 +02:00
Rolf Bjarne Kvinge 37c2d04073
[devops] Fully disable CodeQL, it crashes on x64 as well. (#20693)
Ref: https://dev.azure.com/twcdot/Data/_workitems/edit/137330
2024-06-07 11:22:47 +02:00
Manuel de la Pena 69034245b4
[CI] Remove all references to the tests in the build pipelines. (#20698)
There are now two post build pipelines that run the tests when a new
build has complited building the nuget packages and dependencies. This
allows the project to have a cleaner build pipeline to onboard on the
1ES template.
2024-06-06 17:26:10 -04:00
Rolf Bjarne Kvinge ae155a9798
[AVFoundation] Numerous improvements to the AVSampleCursor type + some other structs. (#20685)
* The AVSampleCursor type was made available on all platforms two years ago (as
  opposed to only macOS before that), so update availability attributes accordingly.

* Also make a few structs used by AVSampleCursor blittable (AVSampleCursorSyncInfo,
  AVSampleCursorDependencyInfo, AVSampleCursorChunkInfo, AVSampleCursorAudioDependencyInfo)

  This got a bit complicated, because some of the non-blittable members of these structs
  are public. This meant a workaround had to be implemented:

  * Rename the properties that use these structures - appending "_Blittable" - and
    make them internal.
  * Create internal "*_Blittable" versions of the structures, and a make the "_Blittable"
    properties return these structures.
  * Bind the properties again, wrapping the internal versions and manually converting
    from the blittable structures to the non-blittable structures.

  Note that since some of the properties are new on iOS and tvOS, we don't need the
  compatibility workaround for these platforms.

Contributes towards #15684.
2024-06-06 17:19:17 +02:00
Rolf Bjarne Kvinge ea77ba0f77
[devops] Disable CodeQL on our older macOS bots too. (#20690) 2024-06-06 17:16:44 +02:00
Rolf Bjarne Kvinge e3d679ea28
[devops] Only call the CodeQL removal script after we've checked out the source code. (#20691) 2024-06-06 09:20:33 +02:00
Rolf Bjarne Kvinge 7670afb6aa
[src/docs] Add xml documentation for types. (#20672)
Import all the xml documentation for types from https://github.com/xamarin/apple-api-docs.

Some of this documentation should probably be rewritten, and potentially moved
to conceptual documentation, in particular those that contain images (because
images can't be imported into xml documentation).

Note that the documentation hasn't been modified in any way; that's not the purpose of this PR. If documentation should be modified for whatever reason, it can be done in a later PR.

The xml documentation for members will come in a later PR.

Partial fix for https://github.com/xamarin/xamarin-macios/issues/17399.
2024-06-06 07:37:52 +02:00
dotnet-maestro[bot] 45b0e70bc0
[main] Update dependencies from dotnet/installer (#20679)
This pull request updates the following dependencies

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

- **Subscription**: 80cb9ffd-f92f-4fc8-9f8b-08dbca46abfb
- **Build**: 20240604.13
- **Date Produced**: June 4, 2024 11:54:26 PM UTC
- **Commit**: 91ea047c8bf55ec4e0e5273bca080dc426260ef6
- **Branch**: refs/heads/release/8.0.1xx

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 8.0.107-servicing.24281.6 to 8.0.107-servicing.24304.13][2]

[2]: c5db09c71d...91ea047c8b
2024-06-06 07:37:37 +02:00
Rolf Bjarne Kvinge 318b380c4a
[devops] Disable codeql in more places, and use a script to avoid code duplication. (#20689) 2024-06-05 19:31:30 +02:00
Rolf Bjarne Kvinge bcc25070cc
[devops] Disable CodeQL on arm64, it's causing problems. (#20686)
Ref: https://twcdot.visualstudio.com/Data/_workitems/edit/116722
2024-06-05 17:17:03 +02:00
Rolf Bjarne Kvinge 5566f4912c
[cecil-tests] Fix blittability check for parameters whose types are pointers. (#20683) 2024-06-05 14:04:14 +02:00
Peter Collins 2abbaf900b
[ci] Improve maestro artifact publishing (#20665)
The steps used to publish build asset information to maestro have been
updated.  The post build stage has been disabled for main and .NET 9, as
maestro manifest generation and channel promotion will now run as part
of the "Prepare .NET Release" stage.

With the new `PushToAzureDevOpsArtifacts` task the build pipeline should
now create all of the artifacts required for maestro artifact
publishing.
The `add-build-to-channel` darc command will now trigger a
[Build Promotion Pipeline][0] that pushes build assets to the feed that
corresponds to the maestro channel that is being updated.  We should
no longer need to push assets to various NuGet feeds in a separate step.

[0]:
https://dev.azure.com/devdiv/DevDiv/_build/results?buildId=9654802&view=logs&j=ba23343f-f710-5af9-782d-5bd26b102304&t=aec38b44-8611-5dd5-3900-5feff4e06d1b

---------

Co-authored-by: Alex Soto <alex@alexsoto.me>
2024-06-04 12:40:53 -04:00
Rolf Bjarne Kvinge 9657179d8c
[cecil-tests] Add new test to verify that we don't have any MarshalAs attributes. (#20678)
This is mostly to ensure that in XAMCORE_5_0 we fix all APIs with MarshalAs
attributes, because in order to not break binary compatibility, we can't fix
all of these failures right now.

Additionally it ensures we don't add more APIs with MarshalAs attributes.
2024-06-04 16:38:43 +02:00
Rolf Bjarne Kvinge 05a9b0872f
[src] Make a few P/Invokes stragglers have blittable signatures. (#20675)
Contributes towards #15684.
2024-06-04 14:51:51 +02:00
Rolf Bjarne Kvinge aa25b1e191
[tests] Fix BundleStructure when building for only tvOS. (#20677)
Fix BundleStructure when building for only tvOS by detecting whether the
bindings are zipped or not by detecting the presence of the zip file, instead
of computing it based on the current platform (which becomes problematic,
because whether or not a binding project produces a zip file may depend on
whether other platforms are enabled or not).
2024-06-04 09:07:51 +02:00
dotnet-maestro[bot] 060694f2cf
[main] Update dependencies from dotnet/installer (#20663)
This pull request updates the following dependencies

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

- **Subscription**: 80cb9ffd-f92f-4fc8-9f8b-08dbca46abfb
- **Build**: 20240531.6
- **Date Produced**: May 31, 2024 9:11:28 PM UTC
- **Commit**: c5db09c71d28ea640973bb48c069e0ab3e2dd5d0
- **Branch**: refs/heads/release/8.0.1xx

- **Updates**:
  - **Microsoft.Dotnet.Sdk.Internal**: [from 8.0.107-servicing.24271.26 to 8.0.107-servicing.24281.6][5]

[5]: 127cf75b9c...c5db09c71d
2024-06-04 09:07:39 +02:00
Rolf Bjarne Kvinge 5557fa32bc
[Network] Make the remaining P/Invokes have blittable signatures. (#20668)
Contributes towards #15684.
2024-06-03 14:29:01 +02:00
dotnet-maestro[bot] a228305941
[main] Update dependencies from dotnet/xharness (#20651)
This pull request updates the following dependencies

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

- **Subscription**: 601bc5e1-1cae-44b5-cf5f-08db9342aa2f
- **Build**: 20240520.4
- **Date Produced**: May 20, 2024 1:23:39 PM UTC
- **Commit**: 8478d1a9a531e6b1cd26fb8c86400e2efbb8f2f3
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.DotNet.XHarness.iOS.Shared**: [from 9.0.0-prerelease.24256.1 to 9.0.0-prerelease.24270.4][1]

[1]: 62a8662088...8478d1a9a5
2024-06-03 13:15:40 +02:00
Rolf Bjarne Kvinge 6dee23142a
[devops] Don't fail the build if the 'Post Debug output' job fails. (#20660) 2024-05-31 16:19:55 +02:00
Rolf Bjarne Kvinge 5c5a4580ec
[Network] Make P/Invokes in NWConnection[Group] have blittable signatures. (#20662)
Contributes towards #15684.
2024-05-31 13:24:20 +02:00
Rolf Bjarne Kvinge 7b3ad09aac
[bgen] Add support for binding static members in protocols. (#20645)
Add support for binding static members in protocols.

Given the following API definition:

```cs
[Protocol]
public interface Protocol {
    [Abstract]
    [Static]
    [Export ("requiredStaticMethod")]
    void RequiredStaticMethod ();

    [Static]
    [Export ("optionalStaticMethod")]
    void OptionalStaticMethod ();

    [Abstract]
    [Static]
    [Export ("requiredStaticProperty")]
    IntPtr RequiredStaticProperty { get; set; }

    [Static]
    [Export ("optionalStaticProperty")]
    IntPtr OptionalStaticProperty { get; set; }
}
```

we're binding it like this:

```cs
[Protocol ("Protocol")]
public interface IProtocol : INativeObject {
    [Export ("requiredStaticMethod")]
    public static void RequiredStaticMethod<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Export ("optionalStaticMethod")]
    public static void OptionalStaticMethod<T> () where T: NSObject, IProtocol { /*  implementation */ }

    [Property ("RequiredStaticProperty")]
    [Export ("requiredStaticProperty")]
    public static IntPtr GetRequiredStaticProperty<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Property ("RequiredStaticProperty")]
    [Export ("setRequiredStaticProperty:")]
    public static void SetRequiredStaticProperty<T> (IntPtr value) where T: NSObject, IProtocol { /* implementation */ }

    [Property ("OptionalStaticProperty")]
    [Export ("optionalStaticProperty")]
    public static IntPtr GetOptionalStaticProperty<T> () where T: NSObject, IProtocol { /* implementation */ }

    [Property ("OptionalStaticProperty")]
    [Export ("setOptionalStaticProperty:")]
    public static void SetOptionalStaticProperty<T> (IntPtr value) where T: NSObject, IProtocol { /* implementation */ }
}
```

Also add documentation and tests.
2024-05-31 13:00:57 +02:00
Rolf Bjarne Kvinge 3efa6c21ff
[tests] Skip framework-test on iOS and tvOS. (#20590)
This test doesn't work when building on iossimulator-arm64 or
tvossimulator-arm64, because we're trying to use a fat framework which doesn't
have that architecture (it contains the device arm64 architecture instead).

So just disable this test on iOS and tvOS - the solution is using an
xcframework, and we already have a different test for that.

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2024-05-30 10:34:14 +02:00
Rolf Bjarne Kvinge 13cec0c657
[AppKit] Improve bindings for NSPasteboard and NSPasteboardReading a bit. (#20643)
* Create strong enums for NSPasteboardType and NSPasteboardName.
* Bind the NSPasteboardReading constructor.

Ref: https://github.com/xamarin/xamarin-macios/issues/14039
2024-05-30 08:23:54 +02:00
Rolf Bjarne Kvinge 36bc43f7dc
[CryptoTokenKit] Bind this framework. Fixes #7876. (#20587)
Fixes https://github.com/xamarin/xamarin-macios/issues/7876.

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2024-05-29 20:38:40 +02:00
Rolf Bjarne Kvinge 3ee3d44c17
[runtime] Remove dead code. (#20655) 2024-05-29 20:15:08 +02:00
Rolf Bjarne Kvinge a0b858ad47
[runtime] Call mono_unhandled_exception to raise AppDomain.UnhandledException. (#20656)
Call mono_unhandled_exception to raise AppDomain.UnhandledException when
managed exceptions are unhandled.

Partial fix for #15252 (for MonoVM, still pending for CoreCLR, which
needs https://github.com/dotnet/runtime/issues/102730 fixed first).
2024-05-29 20:14:47 +02:00
Rolf Bjarne Kvinge 1c7604cde2
[Network] Make P/Invokes in NW*Descriptor and NWWebSocket* have blittable signatures. (#20659)
Contributes towards #15684.
2024-05-29 19:20:54 +02:00
Rolf Bjarne Kvinge eaae1ae6eb
[actions] Improve commit message in the bump-global-json action. (#20649)
Include the PR number and title in the commit message.

This makes GitHub emails a bit more descriptive (since there are often
multiple PRs where global.json is bumped).
2024-05-29 11:49:00 +02:00
Rolf Bjarne Kvinge 8368bc97e9
[AppKit] Fix availability attribute for NSSplitViewItem.CanCollapseFromWindowResize. (#20650)
This property is available starting in macOS 10.14, not macOS 14.0.
2024-05-29 11:25:45 +02:00
Rolf Bjarne Kvinge 2100580024
[Network] Make P/Invokes in NWFramer[Message] have blittable signatures. (#20647)
Contributes towards #15684.
2024-05-29 11:25:34 +02:00
Rolf Bjarne Kvinge 59e84a5e6c
[NSUrlSessionHandler] Only update the request's RequestUri if a redirection occurred. Fixes #20629. (#20633)
The logic to update the request's RequestUri is somewhat old:

518ac1bf19

but it makes sense to do so.

Some testing with a console app, also revealed that a plain .NET does this in
case of a redirect:

```cs
async static Task Main ()
{
    var client = new HttpClient () { BaseAddress = new Uri("https://httpbin.org") };
    var request = new HttpRequestMessage (HttpMethod.Get,
        "/redirect-to?url=https%3A%2F%2Fmicrosoft.com&status_code=302&queries[]={}"
    );
    Console.WriteLine ($"Request uri 1: {request.RequestUri}");
    var response = await client.SendAsync(request);
    Console.WriteLine ($"Request uri 2: {request.RequestUri}");
    var content = await response.Content.ReadAsStringAsync();
    Console.WriteLine ((int) response.StatusCode);
    Console.WriteLine(content.Length);
}
```

prints:

```
Request uri 1: /redirect-to?url=https%3A%2F%2Fmicrosoft.com&status_code=302&queries[]={}
Request uri 2: https://www.microsoft.com/es-es/
200
201252
```

Further looking into .NET's code, `SocketsHttpHandler` updates RequestUri after
following a redirect:

f5eb26e4da/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/RedirectHandler.cs (L65-L66)

So it seems the expected behavior is to update RequestUri only in case of a
redirect.

Now the question becomes: how to detect whether we're a redirect or not?
Contrary to `SocketsHttpHandler`, we don't do the actual redirect, it's
handled transparently by `NSUrlSession`.

Fortunately `NSUrlSessionTask` has two properties which help:
[`OriginalRequest`][1] and [`CurrentRequest`][2]. According to Apple's
documentation, these are the same, "except when the server has responded to
the initial request with a redirect to a different URL."

This sounds perfect for us, so use these two properties to determine whether a redirect occurred.

Note that we can't use object identity, because these are 'copy' properties,
which means they'll never be the same instances, only at most a copy of
eachother. So instead compare the `AbsoluteString` property to check for
equality. As far as I'm aware, none of the other properties (request body,
headers, cookies, etc.) can be set by the server in a redirect, so there's no
need to compare those.

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

[1]: https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411572-originalrequest
[2]: https://developer.apple.com/documentation/foundation/nsurlsessiontask/1411649-currentrequest
2024-05-28 17:35:59 +02:00
Rolf Bjarne Kvinge 3c50f16fbe
[MediaToolbox] Make P/Invokes in MTAudioProcessingTap.cs have blittable signatures. (#20642)
Contributes towards #15684.
2024-05-28 14:58:06 +02:00
Rolf Bjarne Kvinge 4d75d06ab2
[msbuild] Unify MonoBundlingExtraArgs and MtouchExtraArgs into AppBundleExtraOptions. Fixes #12807. (#20594)
Fixes https://github.com/xamarin/xamarin-macios/issues/12807.

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2024-05-28 14:57:52 +02:00
Rolf Bjarne Kvinge 6d764a8bc6
[GameController] GCMouse doesn't conform to NSCoding/NSSecureCoding. (#20641)
GCMouse doesn't conform to NSCoding/NSSecureCoding, so fix the API definition.
Since this would be a breaking change, also add compat code to preserve binary
compatibility.

Fixes this test:

    Introspection.MacApiSelectorTest
        [FAIL] InstanceMethods :   1 errors found in 33428 instance selector validated:
            Selector not found for GameController.GCMouse : encodeWithCoder: in Void EncodeTo(Foundation.NSCoder) on GameController.GCMouse
                Expected: 0
                But was:  1
        [FAIL] Selector not found for GameController.GCMouse : encodeWithCoder: in Void EncodeTo(Foundation.NSCoder) on GameController.GCMouse
             at Introspection.ApiSelectorTest.InstanceMethods() in /Users/rolf/work/maccore/net9.0/xamarin-macios/tests/introspection/ApiSelectorTest.cs:line 1121
2024-05-28 08:34:15 +02:00
Rolf Bjarne Kvinge 7b559b130f
[msbuild] Version the Xamarin.Localization.MSBuild assembly. Fixes #20062. (#20623)
Version the Xamarin.Localization.MSBuild assembly correctly (instead of
hardcoding a 1.0.0 version - implicitly so because no version was set), so
that we can load multiple versions of the assembly into the same process.

Fixes https://github.com/xamarin/xamarin-macios/issues/20062.
2024-05-27 13:56:20 +02:00
Rolf Bjarne Kvinge 85ff5f7e53
[AudioUnit] Make P/Invokes in AUGraph.cs have blittable signatures. (#20636)
Contributes towards #15684.
2024-05-27 12:29:01 +02:00
Rolf Bjarne Kvinge 475ef600b8
[monotouch-test] Be a bit more lenient with expected results in CGImageSourceTest. (#20640)
The exact results seem to depend on a lot of factors, so just accept them all.
2024-05-27 12:26:18 +02:00
Rolf Bjarne Kvinge 0e2fec81be
[Network] Make P/Invokes in NWProtocol* have blittable signatures. (#20638)
Contributes towards #15684.
2024-05-24 14:03:37 +02:00
Rolf Bjarne Kvinge b59ff7cc5c
[src] Fix accidental xml documentation comments. (#20637)
In C# there are two ways to specify that a comment is an xml documentation comment:

1. The single-line '///''
2. The multi-line '/** ... **/'

TIL about the second one, when my upcoming tool to migrate API documentation
to xml comments complained that these members already had an xml comment.

This seems entirely accidental, so just remove/rewrite these few comments.

Also fix a few other typos, grammar mistakes, etc.
2024-05-24 14:03:27 +02:00
Rolf Bjarne Kvinge f78af68fb2
[bgen] Add support for binding constructors in protocols. Fixes #14039. (#20583)
Add support for binding constructors in protocols.

Given the api definition:

```cs
[Protocol]
public interface Protocol {
    [Abstract]
    [Export ("init")]
    IntPtr Constructor ();

    [Export ("initWithValue:")]
    IntPtr Constructor (IntPtr value);

    [BindAs ("Create")]
    [Export ("initWithPlanet:")]
    IntPtr Constructor ();
}
```

we're binding it like this:

```cs
[Protocol ("Protocol")]
public interface IProtocol : INativeObject {
    [Export ("init")]
    public static T CreateInstance<T> () where T: NSObject, IProtocol { /* default implementation */ }

    [Export ("initWithValue:")]
    public static T CreateInstance<T> () where T: NSObject, IProtocol { /* default implementation */ }

    [Export ("initWithPlanet:")]
    public static T Create<T> () where T: NSObject, IProtocol { /* default implementation */ }
}
```

Also add documentation and tests.

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

---------

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Alex Soto <alex@soto.dev>
2024-05-24 11:29:53 +02:00
Rolf Bjarne Kvinge 536f0a1ab7
[runtime] Add support for additional type encodings. Fixes #18562. (#20521)
Fixes https://github.com/xamarin/xamarin-macios/issues/18562.
2024-05-23 16:21:43 +02:00
Rolf Bjarne Kvinge 76cef6cc7d
[Blocks] Remove a block callback validation that's apparently too eager. (#20625)
The validation verifies that the function pointer for a block callback is the
same the return value from the method's
MethodInfo.MethodHandle.GetFunctionPointer() method.

In actual code, it's equivalent to validating that the following always prints "Equal: true":

```cs
[UnmanagedCallersOnly]
public static void Invoke () {}

static void Test ()
{
    delegate* unmanaged<void> fptr1 = &Invoke;
    IntPtr fptr2 = GetType ().GetMethod ("Invoke").MethodHandle.GetFunctionPointer ();
    Console.WriteLine ($"fptr1: 0x{((IntPtr) fptr1).ToString ("x")}");
    Console.WriteLine ($"fptr2: 0x{fptr2.ToString ("x")}");
    Console.WriteLine ($"Equal: ((IntPtr) fptr1) == fptr2}"); // prints "Equal: true" for me
}
```

However, this isn't documented, and some feedback indicates it's certainly not
a valid assumption for CoreCLR:

https://discord.com/channels/732297728826277939/732582981163548703/1242473425759633488

And there's also a customer running into this validation, apparently without cause:
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2054534

So just remove it.
2024-05-23 10:22:54 +02:00
Rolf Bjarne Kvinge 0f91fcdfbc
[cecil-tests] Fix assertion message to use the doc id instead of the typename of a tuple. (#20632)
So instead of this:

> Cecil.Tests.Documentation+AssemblyApi: Documented API not found in the platform assembly. This probably indicates that the code to compute the doc name for a given member is incorrect.

we'll get:

> T:Foundation.SomeType: Documented API not found in the platform assembly. This probably indicates that the code to compute the doc name for a given member is incorrect.
2024-05-23 10:22:06 +02:00
Rolf Bjarne Kvinge 26e6bb82e2
[devops] Look in the correct directory for the API diff results. (#20624)
Fixes this failure:

> 🔥 Unable to find the contents for the comment: D:\a\1\a\change-detection\results\gh-comment.md does not exist :fire

This is a partial revert of #20601, which broke the API diff.
2024-05-23 08:10:03 +02:00
Rolf Bjarne Kvinge a9b23141fd
[AudioUnit] Make P/Invokes in AudioUnit.cs have blittable signatures. (#20620)
Contributes towards #15684.
2024-05-23 08:07:43 +02:00