Xml.IsRuleValid is failing after upgrade from CodeEffects 4.3.7.2 to 5 - rule-engine

We are trying to upgrade from CodeEffects 4.3.7.2 to 5. However, our existing rule xml fail when executing CodeEffects.Rule.Common.Xml.IsRuleValid. We are just loading the Xml into an XmlDocument and calling Xml.IsRuleValid. This is all existing and working code in CodeEffects 4. Below is the exception thrown.
Value cannot be null. Parameter name: input
at System.Xml.XmlReaderSettings.CreateReader(Stream input, Uri baseUri, String baseUriString, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(Stream input, XmlReaderSettings settings, String baseUri)
at CodeEffects.Rule.Common.RuleXmlValidator.AddSchema(XmlSchemaSet schemas, String schemaName, Assembly assembly)
at CodeEffects.Rule.Common.RuleXmlValidator..ctor()
at CodeEffects.Rule.Common.Xml.IsRuleValid(XmlDocument ruleXml)
Here is a sample xml of a rule now failing in this check. "CustomerSince" and "SystemDate" are DateTime.
<?xml version="1.0" encoding="utf-8"?>
<codeeffects xmlns="http://codeeffects.com/schemas/rule/41" xmlns:ui="http://codeeffects.com/schemas/ui/4">
<rule id="ab686e3c-e896-420c-9f8b-5fd09943c939" webrule="4.3.2.71" utc="2016-12-16T07:49:18.9753" type="CompanyABC.Domain.ICustomer, CompanyABC.Domain.State, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" eval="true">
<definition>
<or>
<condition type="isNull">
<property name="CustomerSince" />
</condition>
<condition type="lessOrEqual">
<property name="CustomerSince" />
<property name="SystemDate" />
</condition>
</or>
</definition>
<format><lines /></format>
</rule>
</codeeffects>
I tried using the CodeEffects 5 Classic MVC Rule Editor and generated the below Xml but I still see the same error.
<?xml version="1.0" encoding="utf-8"?>
<codeeffects xmlns="http://codeeffects.com/schemas/rule/41" xmlns:ui="http://codeeffects.com/schemas/ui/4">
<rule id="aecdeec9-9b06-4cb1-910d-8b62c311c72f" webrule="5.0.12.4" utc="2020-05-11T22:04:19.8510" type="CompanyABC.Domain.ICustomer, CompanyABC.Domain.State, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" eval="true">
<definition>
<or ui:block="true">
<condition type="isNull">
<property name="CustomerSince" />
</condition>
<condition type="lessOrEqual">
<property name="CustomerSince" />
<property name="SystemDate" />
</condition>
</or>
</definition>
<format><lines /></format>
</rule>
</codeeffects>
We are using the following libraries from CodeEffects Downloader:
CodeEffects.Rule.Common.dll (5.0.4.2)
CodeEffects.Rule.Engine.Standard.dll (5.0.9.6)
And below from Nuget packages:
CodeEffects.Rule.Editor.Mvc.dll (5.0.12.4)
CodeEffects.Rule.Editor.Net.dll (5.0.12.4)
Any assistance would be appreciated.

This issue has been fixed in the latest minor version released earlier today.

Related

Plotly.js IIS deployment - WebGL setup failed

i tried to deploy my plotly application to an IIS (running under windows server 2012). Unfortunately, the graph is not shown and an error is logged out:
WARN: webgl setup failed possibly due to enabling
preserveDrawingBuffer config. The device may not be supported by
is-mobile module! Inverting preserveDrawingBuffer option in second
attempt to create webgl scene.
as I figured out using the error page, I have to add some rewrites/mime types to my web.config. But it still doesn’t work after.
My web.config looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".mem" />
<mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
<remove fileExtension=".data" />
<mimeMap fileExtension=".data" mimeType="application/octet-stream" />
<remove fileExtension=".memgz" />
<mimeMap fileExtension=".memgz" mimeType="application/octet-stream" />
<remove fileExtension=".datagz" />
<mimeMap fileExtension=".datagz" mimeType="application/octet-stream" />
<remove fileExtension=".unity3dgz" />
<mimeMap fileExtension=".unity3dgz" mimeType="application/octet-stream" />
<remove fileExtension=".jsgz" />
<mimeMap fileExtension=".jsgz" mimeType="application/x-javascript; charset=UTF-8" />
</staticContent>
<rewrite>
<outboundRules>
<rule name="Append gzip Content-Encoding header">
<match serverVariable="RESPONSE_Content-Encoding" pattern=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" pattern="\.unityweb$" />
</conditions>
<action type="Rewrite" value="gzip" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
</configuration>
Dou you have an idea, how to cope with this error?
problem was not caused by IIS (as the error misleadingly states). Error is caused by the current version of plotly, downgrading to version 1.43 fixed the issue.
Somehow the minified version of the new plotly version is not valid.

CodeEffects - Existing rules error after upgrade

After upgrading codeeffects from 4.3.2.6 to 4.3.6.7 existing rules that have any coded actions or methods fail to load with the error:
"The highlighted rule elements could not be located in the current source object. Please update this rule or roll back all changes made to the source object."
Followed by the following in the rules editor
How can this be overcome?
Prior to the upgrade the rules threw no errors and acted against the data as expected.
The errors and the XML below come from the downloaded demo. After updating the demo I encountered the same issues.
The XML for the rule:
<?xml version="1.0" encoding="utf-8"?>
<codeeffects xmlns="http://codeeffects.com/schemas/rule/41" xmlns:ui="http://codeeffects.com/schemas/ui/4">
<rule id="2eb43e80-320c-496f-bf50-7ead12bae886" webrule="4.1.6.4" utc="2014-08-05T15:29:26.3909" type="CodeEffects.Rule.Demo.Bre.Mvc.Models.Patient, CodeEffects.Rule.Demo.Bre.Mvc.2013, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" eval="true">
<name>Check Date</name>
<definition>
<condition type="equal">
<method name="IsToday" type="CodeEffects.Rule.Demo.Bre.Mvc.Services.PatientService, CodeEffects.Rule.Demo.Bre.Mvc.2013, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<value type="System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]">2014-08-06T00:00:00.0000</value>
</method>
<value type="System.Boolean">true</value>
</condition>
</definition>
<format>
<lines />
</format>
</rule>
</codeeffects>
I've tried updating the webrule="4.1.6.4" value in the XML to match the new version without success.
First, please check that your project actually declares the "missing" method. Then post your rule XML here, at least its portion that uses that method if the entire rule is too large.

How do you enable logging for CrmServiceClient in the Xrm Tooling toolkit?

I'm having issues trying to log in to a CRM Online organization through the use of the latest version of the Xrm Tooling nuget package using the connection string constructor from a custom powershell cmdlet.
I'm receiving a rather unhelpful "Unable to Login to Dynamics CRM" error message and am attempting to enable tracing to troubleshoot but have not been able to enable it by modifying the .dll.config file like the below (taken from an XrmToolbox issue on GitHub):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<trace autoflush="true" />
<sources>
<source name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
switchName="Microsoft.Xrm.Tooling.Connector.CrmServiceClient"
switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="console" type="System.Diagnostics.DefaultTraceListener" />
<remove name="Default" />
<add name ="fileListener" />
</listeners>
</source>
<source name="Microsoft.Xrm.Tooling.CrmConnectControl"
switchName="Microsoft.Xrm.Tooling.CrmConnectControl"
switchType="System.Diagnostics.SourceSwitch">
<listeners>
<add name="console" type="System.Diagnostics.DefaultTraceListener" />
<remove name="Default" />
<add name ="fileListener" />
</listeners>
</source>
</sources>
<switches>
<!--
Possible values for switches: Off, Error, Warning, Info, Verbose
Verbose: includes Error, Warning, Info, Trace levels
Info: includes Error, Warning, Info levels
Warning: includes Error, Warning levels
Error: includes Error level
-->
<add name="Microsoft.Xrm.Tooling.Connector.CrmServiceClient" value="Verbose" />
<add name="Microsoft.Xrm.Tooling.CrmConnectControl" value="Verbose" />
<add name="Microsoft.Xrm.Tooling.WebResourceUtility" value="Verbose" />
</switches>
<sharedListeners>
<add name="fileListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="XRMToolingLogs.log" />
<!--<add name="eventLogListener" type="System.Diagnostics.EventLogTraceListener" initializeData="XRMTooling" />-->
</sharedListeners>
</system.diagnostics>
</configuration>
I was able to work around this by configuring the listener programmatically through:
Microsoft.Xrm.Tooling.Connector.TraceControlSettings.TraceLevel = System.Diagnostics.SourceLevels.All;
Microsoft.Xrm.Tooling.Connector.TraceControlSettings.AddTraceListener(new TextWriterTraceListener("log.txt"));
Which pointed me to the actual error which was that the CrmServiceClient was expecting a URL with the organization unique name instead of the URL name.

Nlog with MongoDB connection and target

I am trying to use a logger that will log into MongoDB, but I can not get it to work. In the same configuration i have set up the loggers to log using an email and file and both work just fine.
Here is my NLog.config file
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<extensions>
<add assembly="NLog.MongoDB"/>
</extensions>
<!--
See http://nlog-project.org/wiki/Configuration_file
for information on customizing logging rules and outputs.
-->
<targets>
<target xsi:type="File" name="file" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="Mongo"
name="mongoDefault"
connectionString="mongodb://localhost/nlog"
collectionName="cdss"
cappedCollectionSize="26214400">
<property name="ThreadID" layout="${threadid}" bsonType="Int32" />
<property name="ThreadName" layout="${threadname}" />
<property name="ProcessID" layout="${processid}" bsonType="Int32" />
<property name="ProcessName" layout="${processname:fullName=true}" />
<property name="UserName" layout="${windows-identity}" />
</target>
<target name="TcpOutlet" xsi:type="Chainsaw" address="tcp4://localhost:4505" > </target>
<target name="Email" xsi:type="Mail"
smtpServer="localhost"
smtpPort="25"
smtpAuthentication="None"
enableSsl="false"
from="ssss#sdsdfs"
to="ssss#sdsdfs" html="true"
/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="file,TcpOutlet,mongoDefault,Email" />
<logger name="*" minlevel="Error" writeTo="file,TcpOutlet,Email,mongoDefault" />
</rules>
</nlog>
I have installed the Nlog.Mongo nugget also. My database is called nlog. Whatever i do, the loggers do not write in the mongodb. I am using NLogger.

Quartz.net error in web config file

Trying to get quartz to log in ms sql server but getting error in web config file.
</configSections>
<quartz>
<add key="quartz.scheduler.instanceName" value="SchedulingPOC"/>
<add key="quartz.scheduler.instanceId" value="SchedulingPOC"/>
<!-- Configure Thread Pool -->
<add key="quartz.threadPool.type" value="Quartz.Simpl.SimpleThreadPool, Quartz" />
<add key="quartz.threadPool.threadCount" value="10" />
<add key="quartz.threadPool.threadPriority" value="Normal" />
<!-- Configure Job Store -->
<add key="quartz.jobStore.misfireThreshold" value="60000" />
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz" />
<add key="quartz.jobStore.useProperties" value="true" />
<add key="quartz.jobStore.dataSource" value="default" />
<add key="quartz.jobStore.tablePrefix" value="QRTZ_" />
<add key="quartz.jobStore.lockHandler.type" value="Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz" />
<add key="quartz.dataSource.default.connectionString" value="Server=.\SQLExpress;Database=testDB;Trusted_Connection=True;"/>
<add key="quartz.dataSource.default.provider" value="SqlServer-20" />
</quartz>
Running the application in debug mode of Visual Studio Express for web.
Error message:
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070032
Config Error The configuration section 'quartz' cannot be read because it is missing a section declaration
Config File \?\C:\Users\Anbbb\Desktop\TheProject.Web\web.config
<quartz>
24: <add key="quartz.scheduler.instanceName" value="SchedulingPOC"/>
//The configuration section 'quartz' cannot be read because it is missing a section declaration//
Do you have the "section name" defined in "configSections" ??
<configSections>
<section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
PS
I have a "working" AdoStore example at this post:
Connecting Quartz to MS Sql Server
(One of the answers, not the question)
=======
EDIT
Here is my complete and fully working Quart.Net config, using a SqlServer database.
It ~~assumes~~ you have already created the database.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="quartz" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<quartz>
<add key="quartz.scheduler.instanceName" value="ExampleDefaultQuartzSchedulerFromConfigFileSqlServer"/>
<add key="quartz.scheduler.instanceId" value="instance_one"/>
<add key="quartz.threadPool.threadCount" value="10"/>
<add key="quartz.threadPool.threadPriority" value="Normal"/>
<!--
org.quartz.scheduler.idleWaitTime
Is the amount of time in milliseconds that the scheduler will wait before re-queries for available triggers when the scheduler is otherwise idle. Normally you should not have to 'tune' this parameter, unless you're using XA transactions, and are having problems with delayed firings of triggers that should fire immediately.
It defaults to every 30 seconds until it finds a trigger. Once it finds any triggers, it gets the time of the next trigger to fire and stops checking until then, unless a trigger changes. -->
<add key="quartz.scheduler.idleWaitTime" value ="5000"/>
<!-- Misfire : see http://nurkiewicz.blogspot.com/2012/04/quartz-scheduler-misfire-instructions.html -->
<add key="quartz.jobStore.misfireThreshold" value="60000"/>
<add key="quartz.jobStore.type" value="Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"/>
<add key="quartz.jobStore.tablePrefix" value="QRTZ_"/>
<add key="quartz.jobStore.clustered" value="false"/>
<add key="quartz.jobStore.driverDelegateType" value="Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"/>
<add key="quartz.jobStore.dataSource" value="MySqlServerFullVersion"/>
<!-- connectionStringName -->
<!-- "true" below will result in Couldn't store job: JobDataMap values must be Strings when the 'useProperties' property is set. Key of offending value: myFloatValue
exception. -->
<!-- <add key="quartz.jobStore.useProperties" value="true"/> -->
<add key="quartz.jobStore.useProperties" value="false"/>
<add key="quartz.dataSource.MySqlServerFullVersion.connectionString" value="Server=MyServer\MyInstance;Database=QuartzDB;Trusted_Connection=True;Application Name='quartz_config';"/>
<add key="quartz.dataSource.MySqlServerFullVersion.provider" value="SqlServer-20"/>
</quartz>
</configuration>
This code should work....
NameValueCollection config = (NameValueCollection)ConfigurationManager.GetSection("quartz");
You must change your connection string to an EXISTING database.....that is the Quartz database.....creating using the scripts provided in one of the downloadable projects.
Like this maybe:
https://subversion.assembla.com/svn/pms_michael/database/tables/tables_sqlServer.sql