Closed jemayn closed 10 months ago
I'm not entirely sure this is our issue. Given you are implementing your own repository, it's up to you to ensure the where clause executes on your dataset. I'm guessing there is an issue in how EF is parsing the where clause expression tree 🤔
What happens if you were to execute the same where clause directly on your EF dataset?
Hmm, maybe it is within the where clause it's an issue 🤔
I'm guessing maybe we need to try and null check before performing the ToUpper
and StartsWith
Hmm, maybe it is within the where clause it's an issue 🤔
I'm guessing maybe we need to try and null check before performing the
ToUpper
andStartsWith
Yes that sounds right, it is when calling the .Where(whereClause.Compile()) it fails. The data is just an IEnumerable
This syntax is quite new to me so I may be using it wrong, but it looked like the way to go.
Ok, I've quickly added a null check. I'll push to the nightly server if you want to test it? https://docs.umbraco.com/umbraco-cms/fundamentals/setup/install/installing-nightly-builds (give me a few minutes, but it will be a 12.0.1 preview)
PS Yea, expression trees are soooooo confusing :D
That would be great, I'll test it later off the nightly build then 🙂
Should be there now 12.0.1--preview.1 🤞
Tested with 12.0.1--preview.1 and my issue disappeared and the search works as expected - thanks!
Excellent! I'll make sure this is in the next patch release 👍
Resolved in 10.0.1 and 12.0.1
Describe the bug
If you add a searchable property which is a nullable string and then have data which has null for that value it throws an exception.
Steps To Reproduce Set up a new UI Builder dashboard, something like this:
Where Email is of type
string?
.Then have data which contains classes where atleast one of them has null for the email property.
In the Repository I have code like this:
It fails on the
allItems = allItems.Where(whereClause.Compile());
if the dataset has a searchable property which is null. If I remove that property as searchable or if I set the value to fx an empty string instead of null it works as expected.The error it throws is this:
Expected behavior I would expect it not to throw and return the relevant search results.
Environment (please complete the following information):