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

EnumerableAsyncExtensions hides System.Linq extensions #545

Open
xzwache opened this issue Feb 14, 2024 · 3 comments
Open

EnumerableAsyncExtensions hides System.Linq extensions #545

xzwache opened this issue Feb 14, 2024 · 3 comments

Comments

@xzwache
Copy link

xzwache commented Feb 14, 2024

Hello! We are faced with issue, that

EnumerableAsyncExtensions from namespace Cysharp.Threading.Tasks hides the System.Linq extensions

Case:
You are trying to get all the strings from the of List<string> with Select() method.
What you are excepting to get: IEnumerable<string>
What you are actually get: "Cannot convert expression type 'string' to return type 'Cysharp.Threading.Tasks.UniTask"

This happens because you have a using of Cysharp.Threading.Tasks namespace, that contains this extensions. Until you manually add the System.Linq usage into the file it will show you a error or potentially can cause an unexpected behaviour

Our suggestion is to not use Cysharp.Threading.Tasks namespace for extensions, but add the proper naming like Cysharp.Threading.Tasks.IEnumerable.Extensions (for example) to make usage of such extensions obvious for developers

Thank you!

Screenshot 2024-02-14 at 09 57 56
@neuecc
Copy link
Member

neuecc commented Feb 14, 2024

Thanks, I think this is not a good method name and should be changed to SelectAwait.

@xzwache
Copy link
Author

xzwache commented Feb 14, 2024

Hello! As SelectAsync maybe? What do you think?

@neuecc
Copy link
Member

neuecc commented Feb 14, 2024

For ***Async, we expect Task to be the return value.
The rule we use in Async LINQ is to use ***Await if we receive an async function as an argument (we also adopted the same thing in R3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants