-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
Not Needed
-
There are particular use-cases when Regex.IsMatch method could not be translated and throws ExpressionNotSupportedException exception. Here is minimal code to reproduce the issue (pay your attention to string convert operator it's vital to reproduce):
public class IsMatchTests : Linq3IntegrationTest { [Fact] public void Regex_IsMatch() { var collection = CreateCollection(); var query = collection.AsQueryable() .Where(i => Regex.IsMatch((string)i.A, @"\dB.*", RegexOptions.ECMAScript)); var results = query.ToList(); results.Should().OnlyContain(i => Regex.IsMatch(i.A, @"\dB.*", RegexOptions.ECMAScript)); } private IMongoCollection<Data> CreateCollection() { var collection = GetCollection<Data>("test"); CreateCollection( collection, new Data { Id = 1, A = "ABC" }, new Data { Id = 2, A = "1Br" }); return collection; } private class Data { public int Id { get; set; } public string A { get; set; } } }
- is duplicated by
-
CSHARP-4693 oDATA $matchesPattern support with LINQ3
- Closed