Bug? Rider doesn't offer importing extension method if there's a similar generic method loaded

While working in Unity I encountered an issue - a library has some Extension method for:

GetAwaiter<T>(this T t) where T : IEnumerator

And I have another extension (in a different namespace) for

GetAwaiter(this TimeSpan timeSpan)

But if the namespace containing the first extension is loaded (often needed for other methods), auto-import will not work for the 2nd method.

I will however get an inspection to remove the type constraint.

Is there any way to fix this? Auto-importing extensions saves me a _lot_ of time and cognitive overhead, and I'd love to be able to solve this without dumping everything into the global namespace.

Thanks!

P.S. This is nonspecific to async code: it will repro with any type-constrained extension + another more specific extension,
if only the namespace for the type-constrained one is used.

1
2 comments

Hello,

Thank you for reporting the issue. To me it looks like a bug. I've reproduced it and created an issue for the developers team, please watch it for updates: https://youtrack.jetbrains.com/issue/RSRP-484999

1

Thanks! Will monitor it in the tracker.

0

Please sign in to leave a comment.