VerifyTypeInSDK check in Registrar does not handle 16.0.0 vs 16.0 due to Version API gotcha
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 123
Description
In this [PR](https://github.com/xamarin/xamarin-macios/pull/15608) 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 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 .
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.