Fixing nullable annotations and warnings in Retry#716
Open
algirdasN wants to merge 2 commits intoFlaUI:masterfrom
Open
Fixing nullable annotations and warnings in Retry#716algirdasN wants to merge 2 commits intoFlaUI:masterfrom
algirdasN wants to merge 2 commits intoFlaUI:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes:
After nullable annotation where added to the project, these methods were left out. For delegate parameter on single element Find it makes sense to accept Func that returns a nullable value, because all find methods now return nullable results. For return value it also makes sense because the RetryResult.Result will be null if retry fails to find the element/-s. I also think that the method for locating multiple elements should return an empty array when none are found but changing that would be a breaking change at this point.
This was to align this with other methods that accept a default value. Also removed redundant type parameter on one of this method's call.
Calling GetEnumerator() on each iteration without disposing it might cause issues if the IEnumerable that are backed by unmanaged resources. While vast majority of uses is likely with in-memory collection, I think it is still worth fixing this. Any iterator in essence does the same GetEnumerator().MoveNext() call but disposes of the enumerator afterwards. Cast iterator is required to get the generic version of IEnumerable which is expected by Any(). It also should be possible to remove the null check here, the compiler would warn of possible null reference but I bet that this is used by someone somewhere so I am not comfortable breaking it.