Bug 39153 - return wrong value if async/await used in finally block
Summary: return wrong value if async/await used in finally block
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2016-02-26 07:37 UTC by heebaek choi
Modified: 2016-03-05 10:35 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 on GitHub or Developer Community 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 heebaek choi 2016-02-26 07:37:37 UTC
i know, await in finally block is new feature of c# 6.0 but i think xamarin may not support well.

 public async Task<bool> Test(bool TrueOrFalse)
            if (TrueOrFalse)
                return true;
                return true;
                await Task.Delay(100);

this "Test" function have to return true, but if you run this code, it returns false(default value of bool, if you test other types, it returns default value of that type) 

if i remove await in finally block, this function works well...return true.

repro step is very simple.
just create new android solution and link test button to call this function and watch result...

i spent lots of time cause of this bug...Please fix this bug.
Comment 1 Marek Safar 2016-03-05 10:35:17 UTC
Fixed in master and Mono 4.4