Skip to content

VerifyTypeInSDK check in Registrar does not handle 16.0.0 vs 16.0 due to Version API gotcha #15643

Description

@chamons

In this PR the dotnet test failed with this error:

ILLINK : error MT2362: The linker step 'Registrar' failed during processing: One or more errors occurred. (The type 'Photos.PHPersistentObjectChangeDetails' (used as a return type in Photos.PHPersistentChange.ChangeDetails) is not available in MacCatalyst 16.0 (it was introduced in MacCatalyst 16.0.0). Please build with a newer MacCatalyst SDK (usually done by using the most recent version of Xcode). [/Users/donblas/Programming/xamarin-macios/tests/dotnet/MySimpleApp/MacCatalyst/MySimpleApp.csproj]
  		) (The type 'Photos.PHObjectType' (used as a parameter in Photos.PHPersistentChange.ChangeDetails) is not available in MacCatalyst 16.0 (it was introduced in MacCatalyst 16.0.0). Please build with a newer MacCatalyst SDK (usually done by using the most recent version of Xcode).
  		) (The type 'Photos.PHPersistentChangeFetchResult' (used as a return type in Photos.PHPhotoLibrary.FetchPersistentChanges) is not available in MacCatalyst 16.0 (it was introduced in MacCatalyst 16.0.0). Please build with a newer MacCatalyst SDK (usually done by using the most recent version of Xcode).
  		) (The type 'Photos.PHPersistentChangeToken' (used as a parameter in Photos.PHPhotoLibrary.FetchPersistentChanges) is not available in MacCatalyst 16.0 (it was introduced in MacCatalyst 16.0.0). Please build with a newer MacCatalyst SDK (usually done by using the most recent version of Xcode).

Doing some digging, I believe it is due to this code:

        void VerifyTypeInSDK (ref List<Exception> exceptions, TType type, ObjCMethod parameterIn = null, ObjCMethod returnTypeOf = null, ObjCProperty propertyTypeOf = null, TType baseTypeOf = null)
        {
            var sdkVersion = GetSdkIntroducedVersion (type, out var message);
            if (sdkVersion is null)
                return;

            Version sdk = GetSDKVersion ();
            if (sdkVersion <= sdk)
                return;

because the Version API does completely the wrong thing:

 (Version.Parse ("16.0.0")) <= Version.Parse (("16.0"))     

Doing some more digging, the root setting of the Version appears to be in ./external/Xamarin.MacDev/Xamarin.MacDev/MacCatalystSupport.cs, which I am not touching in the middle of Xcode season.

I will look into hacking the generator to generate the "right" thing, but we really should fix this check OR fix MacCatalystSupport.cs to parse the version as 16.0.0 not 16.0 so this check passes.

The real fix is to make Version sane here, but unfortunately that is not an option .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIf an issue is a bug or a pull request a bug fix

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions