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

BadLinqExpressionException when calling string.Trim #3276

Open
ovyshnevskyy opened this issue Jun 20, 2024 · 1 comment
Open

BadLinqExpressionException when calling string.Trim #3276

ovyshnevskyy opened this issue Jun 20, 2024 · 1 comment

Comments

@ovyshnevskyy
Copy link

After upgrade to Marten "7.19.1" we get next error:
Marten.Exceptions.BadLinqExpressionException
Marten does not (yet) support member string.Trim

In previous version of Marten next code works fine:

return (await GetAsync(
tenantId,
values => values.Where(x => x.Name.Trim().Equals(name.Trim(), StringComparison.OrdinalIgnoreCase)),
cancellationToken))
.FirstOrDefault();

Are you going to fix this in next versions?

@ovyshnevskyy ovyshnevskyy changed the title BadLinqExpressionException when calling string.Trim an Marten 7 does not (yet) support member string.Trim BadLinqExpressionException when calling string.Trim Jun 20, 2024
@jeremydmiller
Copy link
Member

Marten has never supported string.Trim() in LINQ expressions. Maybe it didn't throw an exception on before, but that's not something that's ever been explicitly supported -- an you literally have to explicitly write code to handle every damn thing you could possibly do in LINQ because it's not magic.

This wasn't something that was on my radar at all. Happy to take a PR for this if you want to dive into it. Start with StringMember

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

No branches or pull requests

2 participants