NullReferenceException when Loading Events on Synchronous events execution order

Topics: Bug
Dec 4, 2014 at 9:10 AM
I'm trying to open the "Synchronous events execution order" plugin on my On Premise environment and, everytime I click the "Load Events" button, I get this error message:

An error occured: System.NullReferenceException: object reference not set to an instance of an object.

at MsCrmTools.SynchronousEventOrderEditor.AppCode.SynchronousWorkflow..ctor(Entity workflow)

at MsCrmTools.SynchronousEventOrderEditor.AppCode.SynchronousWorkflow.<RetrievePluginSteps>b__3(Entity e)

at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()

at System.Collections.Generic.List
1.InsertRange(Int32 index, IEnumerable`1 collection)

at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
Dec 4, 2014 at 9:22 AM
It seems that some synchronous workflows do not contain a value for the stage they are executed on. Maybe this is a default value...

I will update the code for the next release

in the same time, if you can check with this SQL query if there is some NULL values on *stage columns
SELECT name, triggeroncreate, triggeronupdate, triggerondelete, createstage, updatestage, deletestage
WHERE triggeroncreate = 1 OR triggeronupdate = 1 OR triggerondelete = 1
Dec 4, 2014 at 1:07 PM
Yes, that was exactly what was happening. One of the workflows was set up to trigger after create, but in the database its "createstage" value was null.
I deactivated the workflow, changed a step name, activated it and the stage name was filled up, so the application did not present any errors.
Dec 4, 2014 at 2:26 PM
I added a check to set default value if NULL Value are found in these attributes. This will be released with the next version
Marked as answer by tanguy92 on 12/4/2014 at 7:26 AM