Three months ago, I wrote a post about profiling workflows with custom activity step -> Debugging custom workflow assemblies
There were couple of comments in the post, about it not working as expected due to
- Different version of CRM and/or
- Different version of Plugin Registration tool
I will now give you the steps to get this working.
- Install LINQPad -> https://www.linqpad.net
- Install CRM Driver for LINQPad -> https://crmlinqpad.codeplex.com/
- After creating a connection to your CRM instance, run this LINQ query
XNamespace mxswa = "{clr-namespace:Microsoft.Xrm.Sdk.Workflow.Activities;assembly=Microsoft.Xrm.Sdk.Workflow, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35}"; var query = from w in WorkflowSet.AsEnumerable() where w.Name == "[YOUR WORKFLOW NAME WITH CUSTOM STEP]" && w.FormattedValues["type"] == "Definition" && w.IsCrmUIWorkflow.GetValueOrDefault() orderby w.ModifiedOn descending select new { w.Id, w.Name, WorkflowVersion = XElement.Parse(w.Xaml).Attributes().FirstOrDefault(a => a.Name.LocalName == "mxswa").Value.Split(';')[1], CustomSteps = from a in XElement.Parse(w.Xaml).Descendants($"{mxswa}ActivityReference") where !a.Attribute("AssemblyQualifiedName").Value.Contains("Microsoft.Crm") select new { CustomStepName = a.Attribute("DisplayName").Value, AssemblyName = a.Attribute("AssemblyQualifiedName").Value, HasArguments = a.Descendants($"{mxswa}ActivityReference.Arguments").Any()} }; query.Where(c=>c.CustomSteps.Any()).Dump(); - You’ll get something like this. Note that the workflow in my case is “Blank Workflow with Custom Step”. Change this to the one you are trying to profile.

Issue 1: Cannot see the workflow step.

If you cannot see the workflow step, that means that there is a mismatch between the Microsoft.Xrm.Sdk.Workflow.dll version and/or your custom workflow step version. Go the folder with the Plugin Registration tool and check the version of the Microsoft.Xrm.Sdk.Workflow.dll version. The important thing is if the major version or minor version of the Microsoft.Xrm.Sdk.Workflow.dll assembly in Plugin Registration tool folder, is different from the one in the Workflow XAML, you will not see the step displayed.

CRM 2016 Plugin Registration Tool

CRM 2016 Update 1 Plugin Registration Tool
Compare this with the results of the LINQ query and confirm that the major version and minor version match. Do this same for your custom workflow assembly as well.
Issue 2: NullReferenceException
There is a bug in the Plugin Registration Tool, that doesn’t allow you to profile workflow steps, that doesn’t have any argument. If you try to do this, you will get this exception.

The workaround for this is to add a dummy argument, to keep the plugin profiler happy.

Hope this helps with your debugging efforts.

Like
Report
*This post is locked for comments