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

feat: Enable Rule CA1851 #16779

Merged

Conversation

workgroupengineering
Copy link
Contributor

What does the pull request do?

CA1851: Possible multiple enumerations of IEnumerable collection

What is the current behavior?

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Part of #8944

@workgroupengineering workgroupengineering mentioned this pull request Aug 22, 2024
33 tasks
@workgroupengineering workgroupengineering marked this pull request as ready for review August 22, 2024 16:21
@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0051433-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0051612-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]


if (rects.Any())
if (_presenter.TextLayout.HitTestTextRange(start, length) is IReadOnlyList<Rect> { Count: > 0 } rects)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's rather problematic, and I don't think should be accepted. As it makes this control to rely on internal implementation of HitTestTextRange.
HitTestTextRange can return an enumerable at any point of time, and it would be really hard to find this problem otherwise.

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0052178-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

var rects = _presenter.TextLayout.HitTestTextRange(start, length);

if (rects.Any())
if (_presenter.TextLayout.HitTestTextRange(start, length) is IReadOnlyList<Rect> { Count: > 0 } rects)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This place wasn't updated

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0052252-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Sep 30, 2024
@maxkatz6 maxkatz6 added enhancement area-infrastructure Issues related to CI/tooling infrastructur and removed feature labels Sep 30, 2024
Merged via the queue into AvaloniaUI:master with commit 36c9de9 Sep 30, 2024
11 checks passed
@workgroupengineering workgroupengineering deleted the features/Analyzers/CA1851 branch September 30, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Issues related to CI/tooling infrastructur enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants