696e7a5679
* [ObjCRuntime] Add a non-deprecated internal system-version checking API and use it everywhere. The PlatformHelper class is deprecated, so implement a new version that isn't deprecated, and which shares a similar API between all platforms - the Check* methods includes the name of the platform, because that makes it clearer which version we're talking about from the call site. There's a quirk though: there's no separate ChecktvOS or CheckMacCatalyst, because the system version is the same as for iOS, so we can just use 'iOS'. For macOS we can now use NSProcessInfo.ProcessInfo.OperatingSystemVersion to determine the OS version, because it's supported in all versions of macOS we support for .NET. Fixes issues such as this when building with XAMCORE_4_0: > CoreMedia/CMSync.cs(590,11): error CS0103: The name 'PlatformHelper' does not exist in the current context * Bring back PlatformHelper.CheckSystemVersion, but only for !NET. * [tests] Remove 32-bit macOS logic, it's long dead. * [introspection] Implement OS version check using 'NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion' for macOS. * [monotouch-test] Use TestRuntime.[Check|Assert]XcodeVersion instead of PlatformHelper.CheckSystemVersion. |
||
---|---|---|
.. | ||
Mac | ||
dotnet | ||
iOS | ||
ApiAvailabilityTest.cs | ||
ApiBaseTest.cs | ||
ApiCMAttachmentTest.cs | ||
ApiClassPtrTest.cs | ||
ApiCoreImageFiltersTest.cs | ||
ApiCtorInitTest.cs | ||
ApiFieldTest.cs | ||
ApiFrameworkTest.cs | ||
ApiPInvokeTest.cs | ||
ApiProtocolTest.cs | ||
ApiSelectorTest.cs | ||
ApiSignatureTest.cs | ||
ApiStructTest.cs | ||
ApiTypeTest.cs | ||
ApiTypoTest.cs | ||
ApiWeakPropertyTest.cs | ||
CoreSelectorTest.cs | ||
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