Bug 12456 - Xamarin Studio doesn't recognize Task<T>.Result type inside continuation
Summary: Xamarin Studio doesn't recognize Task<T>.Result type inside continuation
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 4.0.6
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-05-29 10:23 UTC by Dan Abramov
Modified: 2014-01-24 03:13 UTC (History)
2 users (show)

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

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:
VERIFIED FIXED

Description Dan Abramov 2013-05-29 10:23:15 UTC
Hi, this has been been bugging me for a few months now, so I decided to write.

It's painful to work with Tasks because Xamarin Studio doesn't want to understand Result property type inside a continuation.

So frustrating when you have chains of callbacks.

Example:

        Task<int> Hi ()
        {
            return null;
        }

        public override void ViewDidAppear (bool animated)
        {
            Hi ().ContinueWith (t => {
                Console.WriteLine (t.Result.GetHashCode ());
            });
        }

Xamarin Studio will highlight `Result` red and refuse to understand its type.

http://i.imgur.com/VEzCL3p.png
Comment 1 Mike Krüger 2013-05-31 01:29:54 UTC
Seems to work in master and 4.0.8:

http://screencast.com/t/0f6iA4jv1
Comment 2 Dan Abramov 2013-05-31 03:28:35 UTC
Oddly, it does work for me now, too. I'm not sure what changed (except that I updated MT, but that shouldn't make a difference, as I was running 4.0.8).

Still, there is no autocompletion:

http://imgur.com/a/85T99
Comment 3 Mike Krüger 2013-05-31 04:54:48 UTC
Works for me as well :/

Current master: 
http://screencast.com/t/37O4z0GX

4.0.8:
http://screencast.com/t/BElfBgzAxnQ
Comment 4 Dan Abramov 2013-05-31 06:33:55 UTC
Mike, I'm very confused. How is this possible? What options should I check?
This is very irritating, and more so because it only happens for me.

My info:

=== Xamarin Studio ===

Version 4.0.8 (build 2)
Installation UUID: a12ea7ee-6056-4ee5-80fb-b38d90b05195
Runtime:
	Mono 2.10.12 (mono-2-10/c9b270d)
	GTK 2.24.16
	GTK# (2.12.0.0)
	Package version: 210120000

=== Apple Developer Tools ===

Xcode 4.6.2 (2067.2)
Build 4H1003

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.iOS ===

Version: 6.2.6.6 (Business Edition)
Hash: 991f45c
Branch: 
Build date: 2013-23-05 20:11:20-0400

=== Xamarin.Android ===

Not Installed

=== Build Information ===

Release ID: 400080002
Git revision: 0a09117dec1aed78c735ac46f7a50ae7d12f7a7a
Build date: 2013-05-16 19:36:29+0000
Xamarin addins: 78d0437c3f92ae13042f81e5fd9487e2c28d5fbc

=== Operating System ===

Mac OS X 10.8.3
Darwin Dan.local 12.3.0 Darwin Kernel Version 12.3.0
    Sun Jan  6 22:37:10 PST 2013
    root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
Comment 5 Dan Abramov 2013-05-31 06:51:17 UTC
Also, I can still reproduce this with 4.1.2.

Info after upgrading:

=== Xamarin Studio ===

Version 4.1.2 (build 192)
Installation UUID: a12ea7ee-6056-4ee5-80fb-b38d90b05195
Runtime:
	Mono 3.0.10 ((no/eff4cb5)
	GTK 2.24.18
	GTK# (2.12.0.0)
	Package version: 300100000

=== Apple Developer Tools ===

Xcode 4.6.2 (2067.2)
Build 4H1003

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.iOS ===

Version: 6.3.5.43 (Business Edition)
Hash: 07cde46
Branch: 
Build date: 2013-13-05 14:44:13-0400

=== Xamarin.Android ===

Not Installed

=== Build Information ===

Release ID: 401020192
Git revision: f546050458ae02687a7fbf2178d8cf8455f2da8c
Build date: 2013-05-20 23:20:14+0000
Xamarin addins: ef49d8314090b0a3f561d6eb0473c3a5cc887627

=== Operating System ===

Mac OS X 10.8.3
Darwin Dan.local 12.3.0 Darwin Kernel Version 12.3.0
    Sun Jan  6 22:37:10 PST 2013
    root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
Comment 6 Mikayla Hutchinson [MSFT] 2013-05-31 10:32:34 UTC
Maybe related, I also see unhelpful resolver behavior in lambdas for task continuations.

For example:

System.Threading.Tasks.Task.Factory.StartNew (() => 5).ContinueWith (t => t.

there is no Result property, because the resolver has picked the non-generic overload of ContinueWith, so T is of type Task, not Task<int>.
Comment 7 Dan Abramov 2013-05-31 11:42:09 UTC
Hey Michael,

It indeed seems to be the case that in some cases the resolved picks up non-generic ContinueWith.  
However after updating to 4.1.2 *and* restarting Xamarin Studio for one more time, the bug went away.
Comment 8 Mike Krüger 2013-07-23 03:44:31 UTC
fixed
Comment 9 Prashant manu 2014-01-24 03:13:39 UTC
As per Dan's comment 7, bug does not exist any more.

Hence closing this issue.