After I upgraded CodeEffects.Rule.Editor.Web.Core
nuget from v5.0.14.6 to v5.0.19.4, I'm getting the following NullReferenceException
when calling RuleEditor.GetClientSettings()
:
Message:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
Encoder.GetHashToken(MethodInfo m, String sourceTypeFullName)
SourceLoader.GetTokenByMethod(XmlNode source, Type type, Type sourceObject, String methodName, XmlNodeList parameters, Boolean isMethod)
SourceLoader.GetTokenBySourceMethodNode(XmlNode source, XmlNode method, Type sourceObject)
Settings.Load(IControl control, ICollection`1 contextMenuRules, XmlDocument sourceXml, ICollection`1 dataSourceHolders, Boolean plainSourceXml)
RuleEditor.GetConditions()
RuleEditor.GetClientSettings()
Through elimination I zeroed in to the following method, which seems to be causing the error (this worked in v5.0.14.6):
[Method("IsSingle")]
public bool IsSingle<T>([Parameter(ValueInputType.Fields, Description = "array")] IEnumerable<T> array)
{
return array != null && array.Distinct().SingleOrDefault() != null;
}
The latest version 5.0.20.6 released today fixes this issue. Note that you can't have generic methods with generic params if you use the SourceXML as your source object(s). Switch to plain .Net class(es) or the new FlexSource technology if you do. See this and this documentation articles for details.