Fix IAsyncEnumerable SkipLast for count = 0#1782
Fix IAsyncEnumerable SkipLast for count = 0#1782thibault-reigner wants to merge 4 commits intodotnet:mainfrom
Conversation
|
Could this, instead, throw early for invalid values of |
If I am not mistaken this is already handled in the also enforces. |
|
I see...so there is a case in which we have to return I am thinking about not touching the implementation of SkipLast, but instead having a generic way to wrap Is there more cases like this one, where In any case, good find! |
This seems to be a bit out of scope of this PR and quite some work, as it requires to search for such pattern in all extensions methods of Also, I noticed that there is an extensive use of Do you think such rework would be worth it to spot places where some simplfying logic such as the |
…tually hides an async sequence identity
|
@danielcweber Requested changes were done in e818952 |
Bugfix
Fixes bug where calling
SkipLast(0)over a custom sequence (not being aAsyncIteratorBase:reactive/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SkipLast.cs
Line 36 in 85f1eb7
would result in
CorecallingDequeueover an empty queue, asqueue.Count == count(both value being equal to 0)reactive/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/SkipLast.cs
Line 58 in 85f1eb7
As a fix, I rewrote the
Coremethod usingawait foreachand matching its synchronous implementation forIEnumerableas this version, aside being easier to read, also handles this particular case.reactive/Ix.NET/Source/System.Interactive/System/Linq/Operators/SkipLast.cs
Line 33 in 93386a9
I have also edited the unit test
SkipLast_Zero_NoAliasso this one fails with current version of the code.