You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(That input/RuleParameter is of course defined, it's not what matters here.)
If I catch all CLR exceptions while debugging, I get the following exception:
RulesEngine.Exceptions.RuleException
HResult=0x80131500
Nachricht = Error while compiling rule `TestPdfAttachmentContent1`: No applicable method 'PdfContentContainsSubstring' exists in type 'PdfAttachmentValidator'
Quelle = RulesEngine
Stapelüberwachung:
bei RulesEngine.HelperFunctions.Helpers.HandleRuleException(Exception ex, Rule rule, ReSettings reSettings)
Diese Ausnahme wurde ursprünglich von dieser Aufrufliste ausgelöst:
RulesEngine.HelperFunctions.Helpers.HandleRuleException(System.Exception, RulesEngine.Models.Rule, RulesEngine.Models.ReSettings)
RulesEngine.ExpressionBuilders.LambdaExpressionBuilder.BuildDelegateForRule(RulesEngine.Models.Rule, RulesEngine.Models.RuleParameter[])
RulesEngine.RuleCompiler.BuildRuleFunc(RulesEngine.Models.Rule, RulesEngine.Models.RuleParameter[])
RulesEngine.RuleCompiler.GetDelegateForRule(RulesEngine.Models.Rule, RulesEngine.Models.RuleParameter[])
RulesEngine.RuleCompiler.CompileRule(RulesEngine.Models.Rule, RulesEngine.Models.RuleExpressionType, RulesEngine.Models.RuleParameter[], System.Lazy<RulesEngine.Models.RuleExpressionParameter[]>)
Innere Ausnahme 1:
ParseException: No applicable method 'PdfContentContainsSubstring' exists in type 'PdfAttachmentValidator'
Not, however, and this is a general behavior I don't quite like the exception is silently ignored even though I have explicitly disabled EnableExceptionAsErrorMessage (see below).
Note this is not true, because the PdfAttachmentValidator has such a method, but with an optional second argument:
Apparently, it cannot find PdfContentContainsSubstring("Mahnung") as it cannot find the method signature PdfContentContainsSubstring(string substring, bool caseInsensitive = true).
What should happen
Just call PdfContentContainsSubstring with PdfContentContainsSubstring("Mahnung"), ignoring the optional parameter.
Workaround
Changing it like this and passing the optional parameter explicitly, makes it magically work:
STR
Define a rule as following:
(That input/
RuleParameter
is of course defined, it's not what matters here.)If I catch all CLR exceptions while debugging, I get the following exception:
Not, however, and this is a general behavior I don't quite like the exception is silently ignored even though I have explicitly disabled
EnableExceptionAsErrorMessage
(see below).Note this is not true, because the
PdfAttachmentValidator
has such a method, but with an optional second argument:And yes, I've obviously injected the type:
What happens
Apparently, it cannot find
PdfContentContainsSubstring("Mahnung")
as it cannot find the method signaturePdfContentContainsSubstring(string substring, bool caseInsensitive = true)
.What should happen
Just call
PdfContentContainsSubstring
withPdfContentContainsSubstring("Mahnung")
, ignoring the optional parameter.Workaround
Changing it like this and passing the optional parameter explicitly, makes it magically work:
But this is superfluous, obviously. And I would like to avoid this for obvious reasons.
More information
Weirdly enough, even changing it to
default
does not work (for whatever reason):The (handled) exception then is Unknown identifier 'default':
System
aka .NET 8
Windows 10
The text was updated successfully, but these errors were encountered: