microsoft / microsoft/RulesEngine

Common Language Runtime error

Open
#511 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
616
Avg merge
6m
Merged PRs (30d)
2

Description

I recently upgrade from 4.0.0 to 5.0.1. I am getting errors across the board and it looks like it's related to the breaking change in 5.0.0. In my Utils class I have static methods that take in strongly typed objects (see below). I keep getting a Common Language Runtime error when these rules execute. It appears to be because it can't actually execute my method in the Utils class. Suggestions?

I reviewed the Wiki but the examples shown with Utils is simple string parameters, but do not see any examples with extension methods utilizing strongly typed objects. If I lower back to 4.0.0 everything works as expected.

My expression: customers.Where(CreatedDate >= createdFilterParameter).Where(Utils.IsExistingEmail(Emails, newCustomerDataParameter)).Count() < threshold

public static class Utils
{
    public static bool IsExistingEmail(ICollection<Email> emails, Customer customer)
    {
        if (emails is null || customer is null)
            return false;
			
			
	return emails.Any(x => x.Address.Contains(customer.Email));
    }
}	

Thank you in advance for any suggestions - this library is awesome :)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported expression with the strongly typed Utils.IsExistingEmail method on RulesEngine 5.0.1, then compare the behavior with 4.0.0. Investigate the breaking change described in the report and determine whether the expression is supported; done means a confirmed cause with a minimal reproduction and a documented fix or guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.