This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
Bug 43165 - Async attribute on Abstract attributed method in binding generates invalid code
Summary: Async attribute on Abstract attributed method in binding generates invalid code
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: General (show other bugs)
Version: XI 9.8 (tvOS / C7)
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-08-08 12:30 UTC by John Miller [MSFT]
Modified: 2017-01-19 13:49 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description John Miller [MSFT] 2016-08-08 12:30:06 UTC
**Overview:**

   Adding the [Async] attribute to an [Abstract] attributed method causes invalid code to be generated. 

**Steps to Reproduce:**

   1. Create a binding project
   2. Add this code to the APIDefinition.cs

   // @protocol MyDelegate <NSObject>
	[Protocol, Model]
	[BaseType(typeof(NSObject))]
	interface MyDelegate
	{
		// @required -(void)requireAuthorizationCode:(void (^ _Nonnull)(NSString * _Nullable))completionHandler;
		[Export("requireAuthorizationCode:")]
		[Async]
		[Abstract]
		void RequireAuthorizationCode(Action<NSString> completionHandler);
	}

   3. Build the binding project

**Actual Results:**

   There are syntax errors in the *.g.cs file. 

**Expected Results:**

   The desired result is to end up with something like `Task<NSString> RequireAuthorizationCodeAsync ()` 

**Build Date & Platform:**

=== Xamarin Studio Enterprise ===

Version 6.0.2 (build 73)
Installation UUID: e01c3049-a2d2-4e0a-aad8-afe6fb627c4d
Runtime:
	Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404020011

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.Mac ===

Version: 2.8.2.22 (Xamarin Enterprise)

=== Xamarin.Android ===

Version: 6.1.2.21 (Xamarin Enterprise)
Android SDK: /Users/johnmiller/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.1.7
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: 9.8.2.22 (Xamarin Enterprise)
Hash: f37444a
Branch: cycle7-sr1
Build date: 2016-07-28 12:17:02-0400

=== Xamarin Inspector ===

Version: 0.9.0.14
Hash: 4d868da
Branch: master
Build date: Mon Jun 13 19:14:13 UTC 2016

=== Build Information ===

Release ID: 600020073
Git revision: a6f7a24a9723a2d4f5d33c176615b0d44703ab5b
Build date: 2016-07-26 13:36:15-04
Xamarin addins: f5acb37866a0141bc5ddbe95118f18dae4014568
Build lane: monodevelop-lion-cycle7-sr1

=== Operating System ===

Mac OS X 10.11.2

=== Enabled user installed addins ===

Prism Template Pack 1.3
Xamarin Inspector 0.9.0.14
XamlStyler 1.0.1

**Additional Information:**

   Removing the [Abstract] attribute seems to stop the syntax errors.
Comment 2 Sebastien Pouliot 2017-01-19 03:21:07 UTC
https://github.com/xamarin/xamarin-macios/pull/1529

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