CSHARP-6216ClosedFixed

Wrong regex produced for String.IndexOfAny with an empty or null char array

When a char[] passed to *String.IndexOfAny* in a LINQ Where filter is empty or null, *StringExpressionToRegexFilterTranslator* emits a malformed character class. *anyOf.Length == 0* skips the single-character branch and falls into the else at StringExpressionToRegexFilterTranslator.cs:607, which emits [\\{escapedSet}] with an empty set. A null array throws from the foreach in EscapeCharacterSet. *x.Str.IndexOfAny(Array.Empty<char>()) == 0* rendered as *^[]* and causes server error: "Regular e

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
4.0.03.14.1
Components
Server components related to this issue
LINQ
Labels
Tags and classification

No labels assigned.