Bug 39153

Summary: return wrong value if async/await used in finally block
Product: [Mono] Compilers Reporter: heebaek choi <iphone.grandmaster>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: jonp, mono-bugs+monodroid, mono-bugs+mono
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

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;
            try
            {
                return true;
            }
            finally
            {
                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