Bug 59617 - Fix static registrar to detect invalid type usage
Summary: Fix static registrar to detect invalid type usage
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: master
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.5
Assignee: Rolf Bjarne Kvinge [MSFT]
Depends on:
Reported: 2017-09-20 17:13 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2017-10-03 09:39 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: Yes
Last known good build: 15.3


Description Rolf Bjarne Kvinge [MSFT] 2017-09-20 17:13:29 UTC
See bug #59593:

>  /Users/miltonzurita/Library/Caches/Xamarin/mtbs/builds/---.Mobile.iOS/f9bcae1ae06a29f3d74fe041eda288cd/obj/iPhone/Debug/device-builds/iphone5.2-10.3.3/mtouch-cache/registrar.m:2944:8: error: unknown type name 'MKClusterAnnotation'; did you mean 'MKPointAnnotation'?
>  static MKClusterAnnotation * native_to_managed_trampoline_61 (id self, SEL _cmd, MonoMethod **managed_method_ptr, MKMapView * p0, NSArray * p1, uint32_t token_ref)
>         ^~~~~~~~~~~~~~~~~~~
>         MKPointAnnotation

The static registrar should detect this, and provide a better error.

See also bug #59614 and #59606 (same issue)
Comment 1 Rolf Bjarne Kvinge [MSFT] 2017-09-20 17:16:03 UTC
Test case:

> class X : MapKit.MKMapViewDelegate { 
> 	public override MapKit.MKClusterAnnotation CreateClusterAnnotation (MapKit.MKMapView mapView, MapKit.IMKAnnotation [] memberAnnotations)
> 	{
> 		return base.CreateClusterAnnotation (mapView, memberAnnotations);
> 	}
> }

This regression might have been a good one, because it would have flagged this case as well:

> class X : NSObject, MapKit.IMKMapViewDelegate { }

which currently works fine (with the regression).
Comment 2 Rolf Bjarne Kvinge [MSFT] 2017-09-27 16:56:10 UTC
master: https://github.com/xamarin/xamarin-macios/pull/2790
Comment 3 Rolf Bjarne Kvinge [MSFT] 2017-09-28 15:46:26 UTC
d15-5: https://github.com/xamarin/xamarin-macios/pull/2806
Comment 4 GouriKumari 2017-09-29 20:03:56 UTC
Reproduced wit XI : MTOUCH : error MT4109: Failed to compile the generated registrar code. Please file a bug report at http://bugzilla.xamarin.com

Build Log: https://gist.github.com/GouriKumari/82fea63ea07605b676cc3d5ae21db8cd

Verified with master build, Version:  and getting the correct error message:
error MT4162: The type 'MapKit.MKClusterAnnotation' (used as a return type in testapp.MapTest.CreateClusterAnnotation) is not available in iOS 10.3 (it was introduced in iOS 11.0). Please build with a newer iOS SDK (usually done by using the most recent version of Xcode).

Build Log: https://gist.github.com/GouriKumari/95ed227d356b38e4e5041459cdd8e047

## Test Env:

Note You need to log in before you can comment on or make changes to this bug.