Bug 22665 - Nested async unit tests with Timeout attribute don't assert
Summary: Nested async unit tests with Timeout attribute don't assert
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 7.4.x
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-09-04 18:56 UTC by falz.x1
Modified: 2014-09-05 03:28 UTC (History)
3 users (show)

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 for Bug 22665 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description falz.x1 2014-09-04 18:56:35 UTC
I came across the following bug report and discovered the solution to stop the touch runner freezing while running was to add a timeout attribute to the test. Whilst this does resolve the freezing issue and the test reports successful - 0 assertions are made.


To reproduce:

[Timeout (Int32.MaxValue)]
public async Task AsyncTest()
	await Task.Run(async() =>
		await Task.Delay(1000);

	Assert.AreEqual(1, 1);
Comment 1 falz.x1 2014-09-04 19:03:01 UTC
I've just discovered changing the return type to async void rather than async task gets this working as expected and assertions are made.

However, shouldn't this still be the behaviour when returning a task?
Comment 2 Sadik Ali 2014-09-05 03:28:47 UTC
I have checked this issue and I am able to reproduce this issue.

Steps I followed:

1. Created iOS unit test project.
2. Add a new test file and named it "Tests.cs".
3. Debug test on simulator.
4. Run created test "AsyncTest" 

When I run the case with async and await keywords, I observed the assertions are never made. For the testing, I just write the assert statement before the await Task.Run()  the assertion is working. However, assertions are working without the "async and await" keywords.

Screencast: http://www.screencast.com/t/0qDlexOMJ6

Environment Info:

Mac OS X 10.9.3
Xamarin Studio: 5.3 (build 440)
Mono 3.8.0 ((no/62a857e)
Xcode 5.1 (5084)
Xamarin.iOS : 
=== Build Information ===
Release ID: 503000440
Git revision: accb55419539e512cff857b14b80ec3107996511
Build date: 2014-09-01 08:53:05-04
Xamarin addins: 6dbac4b3a32df080bf98cde838ce89e573a92859