xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.42k stars 507 forks source link

[release/8.0.1xx-xcode15.1] [Blocks] Remove a block callback validation that's apparently too eager. #20700

Closed vs-mobiletools-engineering-service2 closed 1 week ago

vs-mobiletools-engineering-service2 commented 3 weeks ago

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":

[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 withou cause: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2054534

So just remove it.

Backport of #20625

vs-mobiletools-engineering-service2 commented 3 weeks ago

:computer: [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed :computer:

:white_check_mark: All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent Hash: [PR build]

vs-mobiletools-engineering-service2 commented 3 weeks ago

:computer: [PR Build] Tests on macOS M1 - Mac Ventura (13.0) passed :computer:

:white_check_mark: All tests on macOS M1 - Mac Ventura (13.0) passed.

Pipeline on Agent Hash: [PR build]

vs-mobiletools-engineering-service2 commented 3 weeks ago

:books: [PR Build] Artifacts :books:

Packages generated

View packages

Pipeline on Agent Hash: [PR build]

vs-mobiletools-engineering-service2 commented 3 weeks ago

:computer: [CI Build] Windows Integration Tests passed :computer:

:white_check_mark: All Windows Integration Tests passed.

Pipeline on Agent Hash: c5f4e064b7aca06b4891d50c7cb1acfe43a58ab2 [PR build]

vs-mobiletools-engineering-service2 commented 3 weeks ago

:white_check_mark: API diff for current PR / commit

NET (empty diffs) * ~iOS~: (empty diff detected) * ~tvOS~: (empty diff detected) * ~MacCatalyst~: (empty diff detected) * ~macOS~: (empty diff detected)

:white_check_mark: API diff vs stable

.NET (No breaking changes) * iOS: [vsdrops](https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/detected-changes/20240607.8/9694070-1/;/stable-api-comparison/diff/dotnet/Microsoft.iOS.Ref/ref/net8.0/Microsoft.iOS.html) [gist](https://gist.github.com/vs-mobiletools-engineering-service2/2c23e7532cd54e66dedbbc42edfb4731) (No breaking changes) * tvOS: [vsdrops](https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/detected-changes/20240607.8/9694070-1/;/stable-api-comparison/diff/dotnet/Microsoft.tvOS.Ref/ref/net8.0/Microsoft.tvOS.html) [gist](https://gist.github.com/vs-mobiletools-engineering-service2/7075858c1706bf6cbd3429b30ce30401) (No breaking changes) * MacCatalyst: [vsdrops](https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/detected-changes/20240607.8/9694070-1/;/stable-api-comparison/diff/dotnet/Microsoft.MacCatalyst.Ref/ref/net8.0/Microsoft.MacCatalyst.html) [gist](https://gist.github.com/vs-mobiletools-engineering-service2/900ac234379a549dbdc9e32acee5b064) (No breaking changes) * macOS: [vsdrops](https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/detected-changes/20240607.8/9694070-1/;/stable-api-comparison/diff/dotnet/Microsoft.macOS.Ref/ref/net8.0/Microsoft.macOS.html) [gist](https://gist.github.com/vs-mobiletools-engineering-service2/64428579592ed854bf239226ec7cd178) (No breaking changes) * Microsoft.iOS vs Microsoft.MacCatalyst: [vsdrops](https://vsdrop.corp.microsoft.com/file/v1/xamarin-macios/detected-changes/20240607.8/9694070-1/;/stable-api-comparison/diff/dotnet/iOS-MacCatalyst-diff/Microsoft.iOS.Ref/ref/net8.0/Microsoft.iOS.MacCatalyst.html) [gist](https://gist.github.com/vs-mobiletools-engineering-service2/daf86c60bab4d07f6eabb13591adb08b)

:information_source: Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent Hash: c5f4e064b7aca06b4891d50c7cb1acfe43a58ab2 [PR build]

vs-mobiletools-engineering-service2 commented 3 weeks ago

:rocket: [CI Build] Test results :rocket:

Test results

:white_check_mark: All tests passed on VSTS: simulator tests.

:tada: All 95 tests passed :tada:

Tests counts

:white_check_mark: cecil: All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: dotnettests: All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: fsharp: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: framework: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: generator: All 1 tests passed. Html Report (VSDrops) Download :white_check_mark: interdependent_binding_projects: All 4 tests passed. Html Report (VSDrops) Download :warning: install_source: No tests selected. Html Report (VSDrops) Download :white_check_mark: introspection: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: linker: All 40 tests passed. Html Report (VSDrops) Download :warning: mac_binding_project: No tests selected. Html Report (VSDrops) Download :warning: mmp: No tests selected. Html Report (VSDrops) Download :warning: mononative: No tests selected. Html Report (VSDrops) Download :white_check_mark: monotouch: All 29 tests passed. Html Report (VSDrops) Download :white_check_mark: msbuild: All 2 tests passed. Html Report (VSDrops) Download :warning: mtouch: No tests selected. Html Report (VSDrops) Download :warning: xammac: No tests selected. Html Report (VSDrops) Download :white_check_mark: xcframework: All 4 tests passed. Html Report (VSDrops) Download :white_check_mark: xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent Hash: c5f4e064b7aca06b4891d50c7cb1acfe43a58ab2 [PR build]