Bug 12745 - TaskAwaiter.GetResult() throws an exception if the task hasn't completed
Summary: TaskAwaiter.GetResult() throws an exception if the task hasn't completed
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: mscorlib (show other bugs)
Version: master
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-06-18 15:44 UTC by Pierce Boggan [MSFT]
Modified: 2013-08-27 04:27 UTC (History)
6 users (show)

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


Attachments
Tests (366 bytes, application/octet-stream)
2013-06-18 15:44 UTC, Pierce Boggan [MSFT]
Details
Result1 (65.99 KB, image/png)
2013-08-26 11:11 UTC, narayanp
Details
Result2 (118.61 KB, image/png)
2013-08-26 11:11 UTC, narayanp
Details

Description Pierce Boggan [MSFT] 2013-06-18 15:44:36 UTC
Created attachment 4147 [details]
Tests

Description of Issue: TaskAwaiter.GetResult() throws an exception if the task hasn't completed, but the MS implementation blocks until the task completes, like Task.Result does.
Tests: Attached.

Version Information:
=== Xamarin Studio ===

Version 4.1.2 (build 2)
Installation UUID: 092b839b-e4ba-41d0-8ccc-a3bdbc960f0d
Runtime:
Mono 3.0.10 ((no/eff4cb5)
GTK 2.24.18
GTK# (2.12.0.0)
Package version: 300100000

=== Xamarin.Android ===

Version: 4.7.4
Android SDK: /Users/ddunkin/Library/Developer/Xamarin/android-sdk-mac_x86
Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0 (API level 14)
4.0.3 (API level 15)
Java SDK: /usr

=== Apple Developer Tools ===

Xcode 4.6.2 (2067.2)
Build 4H1003

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.iOS ===

Version: 6.3.4.36 (Business Edition)
Hash: 9eb42f8
Branch:
Build date: 2013-11-04 10:49:08-0400

=== Build Information ===

Release ID: 401020002
Git revision: 0fb88a5b486ca8644238e49de32b5c5eb983305d
Build date: 2013-05-06 20:35:00+0000
Xamarin addins: 59d33fcc272e0d0f7211811131eb05d1f994a6b4

=== Operating System ===

Mac OS X 10.8.3
Darwin WS1681.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 1 Miguel de Icaza [MSFT] 2013-06-20 20:53:05 UTC
CCing Jeremie and Marek to get their take.
Comment 2 Marek Safar 2013-06-25 17:25:37 UTC
Can you attach full exception details
Comment 3 Marek Safar 2013-06-27 10:02:40 UTC
Fixed in master
Comment 4 Prashant manu 2013-08-26 03:54:05 UTC
Today I have checked this issue with following builds:

Mac mavericks 10.9
Mac Lion 10.7.4
X.S 4.1.9(build 9)
Mono 3.2.2
X.Android 4.8.2-54

To checked this issue we have created a android template application and copied code from attached file to mainActivity.cs file and the we build and run the project, Project builds successfully but it is showing 'Application does not contain a launchable activity' in status bar of XS. Please let us know are these correct steps which we have tried to verify this issue? or is there something else we have missed to verify this issue.
Comment 5 narayanp 2013-08-26 11:11:05 UTC
And update to comment 4

We have checked this issue on Mac and Windows and followed the below steps:

1. We have created Android Unit Test Project Template
2. We have added attached file 'TaskAwaiterTests.cs' into this project.
3. When have replaced  Assert.NotNull(result) to Console.WriteLine(result.ToString());
4. Debug or run the sample.
5. Click on any Suite.

We are getting result on Mac this is the screenshot attached in bug "Result1" and "Result2" While on Windows we are getting exception after clciking on suite 'BugTests.TaskAwaiterTests'. this is the gist for the same: https://gist.github.com/anonymous/61130e44b3f1f1d42be4

Note: we have not checked it on VS because we are not able to create Android UnitTestProject in VS for that we have reported Bug 14241
Comment 6 narayanp 2013-08-26 11:11:37 UTC
Created attachment 4714 [details]
Result1
Comment 7 narayanp 2013-08-26 11:11:59 UTC
Created attachment 4715 [details]
Result2
Comment 8 Marek Safar 2013-08-27 04:27:09 UTC
That's different bug you are experiencing.

To make this code work you need to change the url from "xamarin.com" to "www.xamarin.com", something like

var req = WebRequest.Create("http://www.xamarin.com");

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