[generator] Using [Async] on a method that does no return void
should be a warning. Fixes bug 53103
#1906
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 returnedresult 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 usedon a member whose return type is not
System.Void
and if youreally want to have
[Async]
on members with different return typeto
System.Void
you can silence the warning by using[Async (allowNonVoidReturnType: true)]
, also using the providedoverloads or by setting the property
AllowNonVoidReturnType
totrue
of the[AsyncAttribute]
.If you use
[Async]
on a member whose return type is notSystem.Void
the returned value of the member will be ignored.
Build diff: https://gist.github.com/dalexsoto/82261d5d7212fd770363dc968c436c98