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

No applicable member has been found for the expression. #163

Open
inseokjoo opened this issue Nov 7, 2024 · 4 comments
Open

No applicable member has been found for the expression. #163

inseokjoo opened this issue Nov 7, 2024 · 4 comments
Assignees

Comments

@inseokjoo
Copy link

inseokjoo commented Nov 7, 2024

Hello, I’m a developer who frequently uses z.Eval and generally finds it very useful. However, I’m unable to resolve an error, so I’m posting this issue here in hopes of getting some guidance.

Here is the error message I encountered:
Z.Expressions.Compiler.Shared.EvalException: Oops! No applicable member has been found for the expression. The error occurred for expression "." at position 3 near ".Where(x => x.IssuedDate.".

My code is as follows:

var query = """
           .Where(x => x.IssuedDate.HasValue && x.IssuedDate.Value.Year == DateTime.Now.Year && CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(x.IssuedDate.Value, CalendarWeekRule.FirstDay, DayOfWeek.Monday) == 20)
           .GroupBy(x => x.QualityIssueStatus)
           .SelectMany(qualityIssueStatusGroup => 
           {
               return qualityIssueStatusGroup.GroupBy(y => qualityIssueStatusGroup.Key)
                   .Select(qualityIssueStatus => new ChartData
                   {
                       Ids = qualityIssueStatus.Select(z => z.Id).ToList(), 
                       Group = qualityIssueStatusGroup.Key, 
                       Key = qualityIssueStatusGroup.Key == qualityIssueStatus.Key ? "Week 20 Quality Issue Count for This Year" : qualityIssueStatus.Key,
                       Value = qualityIssueStatus.Count() 
                   }).ToList();
           }).ToList();
           """;
// C#

queryData = data.Execute(query, new { Param = data });

Is there something I might be missing or have overlooked here?

Additionally, I find the exceptionMessage analysis particularly challenging. Could you provide some guidance on how to better interpret or debug these exceptions? I’d like to continue using this library efficiently.

Thank you in advance for your help!

@JonathanMagnan JonathanMagnan self-assigned this Nov 7, 2024
@JonathanMagnan
Copy link
Member

Hello @inseokjoo,

Do you think you could create a runnable project that reproduces the issue? It will surely help us to work faster on a resolution instead of trying to reproduce it. You can send it in private here if you need: [email protected]

As for the error message, we will see what we can do/answer when we are able to reproduce it.

Best Regards,

Jon

@inseokjoo
Copy link
Author

Hello, @JonathanMagnan

I attempted to send a reproducible project demonstrating the issue via email, but sending it through email was unsuccessful. Instead, I’ve attached it through the following link:

https://drive.google.com/file/d/1wJ5_7So7bFcA-U5B0BkaUTdFfqC_7182/view?usp=sharing

This project reproduces the same error, and I am hoping for a quick resolution. I would appreciate it if you could provide guidance on interpreting this exception message (Exception.Message) as mentioned in the main description. Any pointers for understanding and troubleshooting similar exceptions would be invaluable for helping me continue using this library more efficiently.

Thank you in advance for your assistance.

Best regards,

@JonathanMagnan
Copy link
Member

Thank you for the project, my developer will look at it.

@JonathanMagnan
Copy link
Member

JonathanMagnan commented Nov 14, 2024

Hello @inseokjoo ,

Sorry for the long wait.

My developer told me you were missing to register some type:

EvalManager.DefaultContext.RegisterType(typeof(DayOfWeek));
EvalManager.DefaultContext.RegisterType(typeof(CalendarWeekRule));

We usually recommend explicitly adding your type, but you can also add most of them automatically with the following options: AutoAddMissingTypes

Let me know if everything is working.

Best Regards,

Jon

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

No branches or pull requests

2 participants