Bug 53103 - [generator] Using [Async] on a method that does no return `void` should be an warning
Summary: [generator] Using [Async] on a method that does no return `void` should be an...
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: master
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-03-07 01:27 UTC by Sebastien Pouliot
Modified: 2017-03-24 12:50 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:
RESOLVED INVALID

Description Sebastien Pouliot 2017-03-07 01:27:48 UTC
Right now it's allowed (silently) but the return value is lost.

An error might break compatibility of existing bindings (and the return value might not be valuable). Better use a warning and let /warnaserror be used.
Comment 1 Alex Soto [MSFT] 2017-03-24 01:08:01 UTC
PR: https://github.com/xamarin/xamarin-macios/pull/1906
Comment 2 Alex Soto [MSFT] 2017-03-24 12:50:02 UTC
We do correctly handle this

        [CompilerGenerated]
        public unsafe virtual Task BarStringAsync (int arg1)
        {
            var tcs = new TaskCompletionSource<bool> ();
            var result = BarString(arg1, (obj_) => {
                if (obj_ != null)
                    tcs.SetException (new NSErrorException(obj_));
                else
                    tcs.SetResult (true);
            });
            return tcs.Task;
        }
        
        [CompilerGenerated]
        public unsafe virtual Task BarStringAsync (int arg1, out string result)
        {
            var tcs = new TaskCompletionSource<bool> ();
            result = BarString(arg1, (obj_) => {
                if (obj_ != null)
                    tcs.SetException (new NSErrorException(obj_));
                else
                    tcs.SetResult (true);
            });
            return tcs.Task;
        }