xamarin-macios/tests/introspection
Rolf Bjarne Kvinge 34d1fca7f6
[StoreKit] Bind AppStore.requestReview. Fixes #21410. (#21441)
The existing Objective-C class to request an App Store review (SKStoreReviewController) is deprecated in Xcode 16+, and it doesn't even work on the corresponding OS versions.

The replacement API is Swift-only, but luckily it's a very simple API (just a static method), so it's possible to bind it manually.

This required a few other changes/improvements:

* Add support for Swift code in our runtime.

* Just to keep the changes to a minimum, bump the min OS version for legacy code to match the .NET min OS versions. This is because our build logic uses the legacy min versions when compiling native code (a more involved fix would be to update all the build logic to build native code to use the .NET min OS versions, but that's not the point of this PR, so I took the easy route). Fixes #10659.

I've tested the method locally, and it seems to work fine, but I've still marked
it as experimental for now. There are no unit tests because calling the method will
put up a dialog, which won't work correctly in unit tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/21410.
Fixes https://github.com/xamarin/xamarin-macios/issues/10659.
2024-10-16 11:06:47 +02:00
..
Mac Merge remote-tracking branch 'origin/net9.0' into merge-net9.0-into-main 2024-10-01 17:03:30 +02:00
dotnet [dotnet] Don't link with BrowserEngineKit. Fixes #21324. (#21337) 2024-10-02 19:54:47 +02:00
iOS Merge remote-tracking branch 'origin/net9.0' into merge-net9.0-into-main 2024-10-01 17:03:30 +02:00
ApiAvailabilityTest.cs Change all null checking expressions to use 'is' and 'is not'. (#18176) 2023-05-05 17:52:19 +02:00
ApiBaseTest.cs [xcode16] Merge main into xcode16. 2024-09-12 11:10:51 +02:00
ApiCMAttachmentTest.cs Merge remote-tracking branch 'origin/main' into dev/rolf/bump-main-in-net9.0-2024-09-18 2024-09-19 09:48:34 +02:00
ApiClassPtrTest.cs Change all null checking expressions to use 'is' and 'is not'. (#18176) 2023-05-05 17:52:19 +02:00
ApiCoreImageFiltersTest.cs [CoreImage] Implement Xcode 16.0 beta 1 and beta 2 changes. 2024-07-09 10:22:50 +02:00
ApiCtorInitTest.cs [xcode16] Misc fixes after running tests on macOS Sequoia. (#21193) 2024-09-11 20:56:55 +02:00
ApiFieldTest.cs [Introspection] Fix failing tests. 2023-08-04 11:47:29 -04:00
ApiFrameworkTest.cs [RGen] First inclusion of a roslyn generator for the bindings. (#21389) 2024-10-15 14:56:09 -04:00
ApiPInvokeTest.cs [tests] Remove mono-native logic. (#21312) 2024-10-01 01:03:06 +02:00
ApiProtocolTest.cs [StoreKit] Bind AppStore.requestReview. Fixes #21410. (#21441) 2024-10-16 11:06:47 +02:00
ApiSelectorTest.cs [StoreKit] Bind AppStore.requestReview. Fixes #21410. (#21441) 2024-10-16 11:06:47 +02:00
ApiSignatureTest.cs [tests] Fix ignoring members based on OSPlatformAttributes. (#21192) 2024-09-11 20:24:03 +02:00
ApiStructTest.cs Change all null checking expressions to use 'is' and 'is not'. (#18176) 2023-05-05 17:52:19 +02:00
ApiTypeTest.cs [net9.0] Update dependencies from dotnet/sdk (#20621) 2024-06-25 13:49:44 +02:00
ApiTypoTest.cs [xcode15.3] Bump to Xcode 15.3 bindings (#20780) 2024-07-11 11:41:31 +02:00
ApiWeakPropertyTest.cs [CoreText] Fix a few nullability issues in CTFontDescriptor. (#19439) 2023-11-21 07:59:13 +01:00
CoreSelectorTest.cs [autoformat] Add introspection. (#16593) 2022-11-07 15:20:26 +01:00
EnvironmentVariable.cs
README.md
xamarin1.png

README.md

Introspection Tests

Introspection tests are executed on target (both simulator and device for iOS) or a specific version of OSX. The application proceed to analyze itself using:

  • System.Reflection for managed code; and
  • the ObjectiveC runtime library for native code

and compare the results. E.g. if using .NET reflection it can see a binding for a NSBundle type then it should be able to find a native NSBundle type using the ObjC runtime functions. Otherwise an error is raised...

Since the application analyze itself it must contains everything we wish to test. That's why the introspection tests needs to be built with the managed linker disable, i.e. "Don't link".

Pros

  • The tests always tell the truth, which can differ from documentation or header files;

Cons

  • Incomplete - Not everything is encoded in the metadata / executable;
  • Too complete - Not every truth is good to be known (or published), which requires creating special cases in the tests