System.Linq.Dynamic.Core icon indicating copy to clipboard operation
System.Linq.Dynamic.Core copied to clipboard

Exception while parsing expression ')' or ',' expected

Open David-Moreira opened this issue 4 years ago • 12 comments

--Exception while parsing expression (RuleContextInputTag.ProductOrder.ProductOrderItem.Any(ProductOrderItem=>ProductOrderItem.ProductOffering.Name=="Testing Value"&&ProductOrderItem._ProductOrderItem.Any(_ProductOrderItem=>_ProductOrderItem.ProductOffering.Name=="Testing Value"))) - ')' or ',' expected

Hello guys. This error is driving me insane, I can't seem to figure out what is wrong about this expression. Can someone help me please? :)

David-Moreira avatar Jan 28 '21 15:01 David-Moreira

Hello @David-Moreira, Your code example is difficult to read, can you please provide a full C# exaple?

StefH avatar Jan 28 '21 16:01 StefH

Sorry for not replying... Been quite busy. I ended up figuring out the problem.

Apparently when accessing using LINQ on a List within a List, if we use the same name for the LINQ accessor(_ProductOrderItem.Any(_ProductOrderItem=>) as the List Property this happens.

It is of note, that both ProductOrderItem and _ProductOrderItem are Lists of the same TYPE. I'm not sure if that is to be expected. I will provide an example when I have the time. Problem: (RuleContextInputTag.ProductOrder.ProductOrderItem.Any(ProductOrderItem=>ProductOrderItem.ProductOffering.Name=="Testing Value"&&ProductOrderItem._ProductOrderItem.Any(_ProductOrderItem=>_ProductOrderItem.ProductOffering.Name=="Testing Value"))) Solution: (RuleContextInputTag.ProductOrder.ProductOrderItem.Any(x=>x.ProductOffering.Name=="Testing Value"&&x._ProductOrderItem.Any(y=>y.ProductOffering.Name=="Testing Value")))

David-Moreira avatar Feb 01 '21 17:02 David-Moreira

Hello, @StefH If you'd be so kind to take a look, here's the full c# example: https://github.com/David-Moreira/ListWithinList

David-Moreira avatar Feb 04 '21 20:02 David-Moreira

@StefH Had any time to take a look at this yet?

David-Moreira avatar Mar 07 '21 12:03 David-Moreira

@David-Moreira not yet in detail. Sorry.

StefH avatar Mar 08 '21 19:03 StefH

Alright, thanks!

David-Moreira avatar Mar 08 '21 22:03 David-Moreira

Hello @StefH I know you're probably busy with other stuff, and this issue isn't really that critical, but just a friendly reminder, if you can squeeze a tiny bit of time to take a look at this!! Appreciated, Thanks!

David-Moreira avatar Apr 13 '21 18:04 David-Moreira

@David-Moreira I promise I'll take a look at your example code and debug the error.

However, I think that solving this issue needs some refactoring internally on the way the identifiers are saved.

StefH avatar Apr 13 '21 19:04 StefH

I see. Thanks once again @StefH

David-Moreira avatar Apr 13 '21 20:04 David-Moreira

Registering my interest in this : )

This is affecting another package I am using Microsoft Rules Engine

sebastianwhiffen avatar Apr 11 '24 04:04 sebastianwhiffen

Hello, @StefH If you'd be so kind to take a look, here's the full c# example: https://github.com/David-Moreira/ListWithinList

This Repo is no longer available it seems, I would love to begin investigating how I can work around this. Is it deleted or just private? if the latter, could you allow me access ❤️

sebastianwhiffen avatar Apr 11 '24 04:04 sebastianwhiffen

Hello, @StefH If you'd be so kind to take a look, here's the full c# example: https://github.com/David-Moreira/ListWithinList

This Repo is no longer available it seems, I would love to begin investigating how I can work around this. Is it deleted or just private? if the latter, could you allow me access ❤️

Hello sebastian. It's deleted. If I remember correctly I was able to work around this somehow. But that project is long gone so I don't have the details with me anymore. If my memory serves me right, I managed to somehow work around it by using the it functionality that's specific to dynamic linq and represents the item in the current lambda.

image

The docs over here are really good: https://dynamic-linq.net/expression-language

David-Moreira avatar Apr 11 '24 08:04 David-Moreira