8
\$\begingroup\$

Please post your nominations for the Best of Code Review 2016 - Exterminator category.

Answer that points out the most interesting obscure bug in the original code.

In your nomination post, please make sure to include a link to the nominated answer, as well as a short explanation of what makes that post worthy of being nominated in this category, and why it should win over the others.


Small characters at the bottom: Only one nomination per post. Nominated answers must have a creation date in 2016. Downvotes don't count. Santa reserves the right to award the top-voted nominee a special bounty as a token of appreciation on behalf of the Code Review community.

\$\endgroup\$

1 Answer 1

9
\$\begingroup\$

I'm going to nominate my own answer here:

CultureInfo with fallback routing to another language

OP had built a FallbackCultureInfo which was designed to fall back to a different CultureInfo if the first one failed to localize the provided string. Simple, and this functionality is built into CultureInfo for a reason.

What OP failed to realize is that the FallbackCultureInfo would only work properly in a programme one time. I noticed this due to the static member in it.

What surprised me was the nature of the two bugs I discovered.

First: there was a bug if you provided a set of culture info's, then tried to construct a new fallback with another set, that included any culture info except the last of the first set. It basically skipped part of the process.

Second: this was more interesting. If you provided two CultureInfo items with the same parent (en-US and en-UK), then a third (or more) it would enter an infinite loop when traversing the parent. en-US -> en -> en-UK -> en -> en-UK -> ...

Both of these bugs were very curious, and created quite a havoc if the object was used incorrectly.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .