Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generator] Using [Async] on a method that does no return void should be a warning. Fixes bug 53103 #1906

Closed
wants to merge 1 commit into from

Conversation

dalexsoto
Copy link
Member

@dalexsoto dalexsoto commented Mar 24, 2017

https://bugzilla.xamarin.com/show_bug.cgi?id=53103

We currently allow using [Async] on members whose return type is not
System.Void, this leads to silently ignoring the actual returned
result of the called member.

We have some cases on our own but fixing them is a breaking change
so if XAMCORE_4_0 ever happens we will have another look to them.

We now issue a warning (BI1118) whenever we find [Async] being used
on a member whose return type is not System.Void and if you
really want to have [Async] on members with different return type
to System.Void you can silence the warning by using
[Async (allowNonVoidReturnType: true)], also using the provided
overloads or by setting the property AllowNonVoidReturnType to
true of the [AsyncAttribute].

If you use [Async] on a member whose return type is not System.Void
the returned value of the member will be ignored.

Build diff: https://gist.github.com/dalexsoto/82261d5d7212fd770363dc968c436c98

…turn `void` should be an warning

https://bugzilla.xamarin.com/show_bug.cgi?id=53103

We currently allow using [Async] on members whose return type is not
`System.Void`, this leads to silently ignoring the actual returned
result of the called member.

We have some cases on our own but fixing them is a breaking change
so if XAMCORE_4_0 ever happens we will have another look to them.

We now issue a warning (BI1118) whenever we find `[Async]` being used
on a member whose return type **is not** `System.Void` and if you
really want to have `[Async]` on members with different return type
to `System.Void` you can silence the warning by using
`[Async (allowNonVoidReturnType: true)]`, also using the provided
overloads or by setting the property `AllowNonVoidReturnType` to
`true` of the `[AsyncAttribute]`.

If you use `[Async]` on a member whose return type **is not** `System.Void`
the returned value of the member will be **ignored**.
@monojenkins
Copy link
Collaborator

Build success

@dalexsoto dalexsoto added the do-not-merge Do not merge this pull request label Mar 24, 2017
@dalexsoto
Copy link
Member Author

We do handle the non void return types using AsyncAttribute correctly, will update docs in a new pr to reflect this

You can use the [Async] attribute on methods that return void and whose last argument is a callback.

@dalexsoto dalexsoto closed this Mar 24, 2017
@dalexsoto dalexsoto deleted the bug53103 branch March 24, 2017 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge Do not merge this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants