Skip to content

Avoid using a culture-sensitive EndsWith in common code #3583

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

Merged
merged 1 commit into from
Jun 19, 2020

Conversation

jskeet
Copy link
Contributor

@jskeet jskeet commented Jun 13, 2020

This was causing a similar issue to #1555, due to TupleComparer and
ValueTupleComparer (in the NUnitEqualityComparer chain) calling into
TypeHelper.

(The impact for NodaTime is that tests on Linux in en-GB take 5-6
times as long as they should. We perform a lot of equality
comparisons which get as far as EquatablesComparer in the chain.)

It would be good to take a complete audit of StartsWith and EndsWith
calls (and maybe even have a Roslyn-based unit test to make sure
that any culture-sensitive calls are deliberately so), but I don't
have the expertise to make the calls for other parts of the
codebase. I'm pretty confident about this one :)

This was causing a similar issue to nunit#1555, due to TupleComparer and
ValueTupleComparer (in the NUnitEqualityComparer chain) calling into
TypeHelper.

(The impact for NodaTime is that tests on Linux in en-GB take 5-6
times as long as they should. We perform a lot of equality
comparisons which get as far as EquatablesComparer in the chain.)

It would be good to take a complete audit of StartsWith and EndsWith
calls (and maybe even have a Roslyn-based unit test to make sure
that any culture-sensitive calls are deliberately so), but I don't
have the expertise to make the calls for other parts of the
codebase. I'm pretty confident about this one :)
Copy link
Member

@mikkelbu mikkelbu left a comment

Choose a reason for hiding this comment

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

LGTM. We need a second review before merging. Thanks for the contribution @jskeet 👍

@ChrisMaddock
Copy link
Member

Looks good - thanks! 😄

@jnm2
Copy link
Contributor

jnm2 commented Jun 28, 2020

It would be good to take a complete audit of StartsWith and EndsWith
calls (and maybe even have a Roslyn-based unit test to make sure
that any culture-sensitive calls are deliberately so), but I don't
have the expertise to make the calls for other parts of the
codebase. I'm pretty confident about this one :)

This one thing I've wanted to address. I filed #3588 and suggested Fxcop Analyzers. Roslyn-based unit tests are great, but I would only find out about the test failure after submitting a PR and seeing CI fail. Analyzers are nice and immediate.

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

Successfully merging this pull request may close these issues.

4 participants