Bug 25673 - Interface with Async Methods (returning Task) can't be implemented in Android and iOS projects using DependencyService
Summary: Interface with Async Methods (returning Task) can't be implemented in Android...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2014-12-31 13:59 UTC by Hamza Anjum
Modified: 2015-05-19 15:16 UTC (History)
7 users (show)

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

Screenshot (69.74 KB, image/png)
2014-12-31 13:59 UTC, Hamza Anjum
Adding Dependency assembly on the top gets me a few errors, applying this quick fix creates the actual error that I actually posted about. (154.16 KB, image/png)
2015-01-07 11:44 UTC, Hamza Anjum
Build Info (3.20 KB, text/plain)
2015-01-07 11:47 UTC, Hamza Anjum
A Project in which the quick fix is applied, and hence the System.Runtime Library is added. (6.05 MB, application/octet-stream)
2015-01-07 11:54 UTC, Hamza Anjum

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:

Description Hamza Anjum 2014-12-31 13:59:36 UTC
Created attachment 9219 [details]

I am following "Creating Mobile Apps with Xamarin.Forms" book by Charles Petzold for learning Xamarin.Forms

In chapter 3, Version 6 of the App, when the async methods were tried to created in the interface to be used for DependencyService for PCL project, the error encoutered.

Basically the problem is that when the return type of the Method is set to be Task (for async methods) in the interface, and then the class in platform projects the class implements the interface, the windows phone project works just fine, but the android and iOS projects

Error	CS0738	'FileHelper' does not implement interface member 'IFileHelper.ExistsAsync(string)'. 'FileHelper.ExistsAsync(string)' cannot implement 'IFileHelper.ExistsAsync(string)' because it does not have the matching return type of 'Task<bool>'.

But you can clearly see in the Attached screenshot that Task<bool> is the return type of the ExistsAsync method in the Android Project (the one in the center)

The same error is reported 3 times, one for each method.
Comment 1 Arpit Jha 2015-01-07 07:28:52 UTC
We have checked this issue and unable to reproduce this issue .

Could you please provide us  sample project and build info ,so that we can able to reproduce this issue at our end.?

You can copy build info from here

In VS ->Help ->About Microsoft visual studio and copy info.
Comment 2 Hamza Anjum 2015-01-07 11:44:39 UTC
Created attachment 9268 [details]
Adding Dependency assembly on the top gets me a few errors, applying this quick fix creates the actual error that I actually posted about.
Comment 3 Hamza Anjum 2015-01-07 11:47:18 UTC
Created attachment 9269 [details]
Build Info
Comment 4 Hamza Anjum 2015-01-07 11:54:05 UTC
Created attachment 9271 [details]
A Project in which the quick fix is applied, and hence the System.Runtime Library is added.
Comment 5 Hamza Anjum 2015-01-07 11:57:26 UTC
I have added some more attachments.
I have actually resolved the issue, but prior to building the solution, Visual Studio keeps on showing that there are errors in the Code.
Can you clear out about what can be done about it?

By the way, thank you very much for the response from your side, it made me once again open my project after so many days and start pondering on it again, and hence helping me out to resolve the issue :D
Comment 6 Arpit Jha 2015-01-08 02:04:54 UTC
I have checked this issue and able to reproduce this issue with the help of bug description and comment 4.

Screencast : http://www.screencast.com/t/jdVh3i2T
Ide log : https://gist.github.com/RamChBachkheti/a602327b8be49fafec63
Error : https://gist.github.com/RamChBachkheti/7ee89af4da87ea34247b
Environment Info: 


Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Xamarin (10cfd178d55287f09c85f5a1e604dfe20889a40f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (840a925103a0bf4a856507f13d5eaee3c1579c2f)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 7 Grigory (Playtika) 2015-01-13 15:53:26 UTC
Reproduced this issue.
Class in Android project implements interface from PCL project. 

Microsoft Visual Studio Ultimate 2015 Preview
Version 14.0.22310.1 DP
Microsoft .NET Framework Version 4.5.53349

Installed Version: Ultimate
Comment 8 Ron Richins 2015-01-22 14:21:04 UTC
How did you resolve the issue?
Comment 9 Hamza Anjum 2015-01-22 21:02:20 UTC
By removing the System.Runtime Library's Reference from the Projects.

Though is shows that the error is there while writing code, but it builds without any errors.
Comment 10 Muhammad Azeem 2015-02-19 02:20:40 UTC
Any update on this bug? This is a serious bug for us and we are hoping that it gets fixed as soon as possible.
Comment 11 Hamza Anjum 2015-02-19 12:46:43 UTC
I have got no idea about the next steps.

The team was able to reproduce the issue and have marked its status as CONFIRMED. Most probably they are working on it now.
Comment 12 Muhammad Azeem 2015-03-17 04:25:01 UTC
It is fixed in Xamarin Forms version 1.3.4
Comment 13 Jason Smith [MSFT] 2015-05-19 15:16:50 UTC
No longer happens with latest Xamarin + X.F.