Bug 59617 - Fix static registrar to detect invalid type usage
Summary: Fix static registrar to detect invalid type usage
Status: RESOLVED FIXED
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]
URL:
Depends on:
Blocks:
 
Reported: 2017-09-20 17:13 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2017-10-03 09:39 UTC (History)
2 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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 11.0.0.0.pkg : 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: 11.5.0.97  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:
https://gist.github.com/e9bba16e96b1adae3e2a4a665cebc508