CRM 2016 online - debug custom workflow activity crashes plugin registration tool

2

I wanted to use Plugin Registration Tool (from now on referenced as PRT) to debug custom workflow activity with CRM 2016 online. My problem is that whenever I click on "Profile Workflow" button, PRT crashes.

Details on crash are found in event log and are stated below.

Event log entry one:

Faulting application name: PluginRegistration.exe, version: 8.2.1.8676, time stamp: 0x58d073d5 Faulting module name: KERNELBASE.dll, version: 10.0.15063.296, time stamp: 0xa0527b0c Exception code: 0xe0434352 Fault offset: 0x0000000000069e08 Faulting process id: 0xb70 Faulting application start time: 0x01d2ea6794b7727a Faulting application path: D:_temp\SDK\Tools\PluginRegistration\PluginRegistration.exe Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll Report Id: 21f5bf85-22be-44ca-b884-ef43d9490886 Faulting package full name: Faulting package-relative application ID:

Event log entry two:

Application: PluginRegistration.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.Xml.XPath.XPathException at MS.Internal.Xml.XPath.XPathParser.CheckToken(LexKind) at MS.Internal.Xml.XPath.XPathParser.ParsePredicate(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseStep(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseRelativeLocationPath(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParsePathExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseUnionExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseMultiplicativeExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseAdditiveExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseRelationalExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseEqualityExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseAndExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseOrExpr(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseExpresion(MS.Internal.Xml.XPath.AstNode) at MS.Internal.Xml.XPath.XPathParser.ParseXPathExpresion(System.String) at System.Xml.XPath.XPathExpression.Compile(System.String, System.Xml.IXmlNamespaceResolver) at System.Xml.XPath.XPathNavigator.Compile(System.String) at System.Xml.XmlNode.SelectSingleNode(System.String, System.Xml.XmlNamespaceManager) at PluginProfiler.Library.WorkflowXamlUtility.GetCustomActivityFullyQualifiedName(System.String, System.Xml.XmlNode, System.Xml.XmlNamespaceManager) at PluginProfiler.Library.WorkflowXamlUtility.GetCustomActivityFullyQualifiedNames(Microsoft.Xrm.Tooling.Connector.CrmServiceClient, System.Xml.XmlDocument, System.Xml.XmlNamespaceManager) at PluginProfiler.Library.WorkflowXamlUtility.GetWorkflowActivitySteps(Microsoft.Xrm.Tooling.Connector.CrmServiceClient, System.String) at Microsoft.Crm.Tools.PluginRegistration.CommonControls.ExistingWorkflow.Refresh() at Microsoft.Crm.Tools.PluginRegistration.CommonControls.ProfilerSettingsViewModel.set_SelectedWorkFlow(Microsoft.Crm.Tools.PluginRegistration.CommonControls.ExistingWorkflow) at Microsoft.Crm.Tools.PluginRegistration.CommonControls.ProfilerSettingsViewModel.RefreshWorkflows() at Microsoft.Crm.Tools.PluginRegistration.CommonControls.ProfilerSettingsViewModel..ctor(Microsoft.Crm.Tools.Libraries.CrmOrganization, PluginProfiler.OperationType, System.Guid, Microsoft.Crm.Tools.PluginRegistration.CommonControls.ProfilerSettingsView) at Microsoft.Crm.Tools.PluginRegistration.OrganizationControlViewModel.StartProfiler_Clicked() at Microsoft.Crm.Tools.PluginRegistration.OrganizationControlViewModel.MenuItem_Clicked(System.Object) at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, Boolean) at System.Windows.Controls.MenuItem.InvokeClickAfterRender(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.DispatcherOperation.InvokeImpl() at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.ProcessQueue() at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) at System.Windows.Application.RunDispatcher(System.Object) at System.Windows.Application.RunInternal(System.Windows.Window) at Microsoft.Crm.Tools.PluginRegistration.App.Main()

Both event log entries are created at same time when plugin crashed.

I've spent last our googling, trying to find someone with at least similar problem, but I failed :)

Is there any solution for this?

workflow
dynamics-crm-online
asked on Stack Overflow Jun 21, 2017 by joksa • edited Jun 22, 2017 by DimaSan

3 Answers

1

I've seen behavior like this before with plugins and custom workflow activities depending on the actions taken within the code. For example, if my plugin does an http request I've seen that crash the PRT, I don't know for sure but it may be that the PRT doesn't allow that type of thing if it's debugging in a sandboxed environment.

An alternative to directly debugging the custom workflow activity or plugin is to create a new custom entity with some fields to store information such as the user id the code is running as, the name of the plugin or workflow activity, exception message, etc. and then in the code write to a StringBuilder object in the same way you might write useful information out to the tracing object. In a catch block or always at the end of the code you can create a new record of the custom entity and store the information from the StringBuilder and plugin context, etc. I've used this in a lot of situations where I want to output custom detailed info for debugging or testing as long as the plugin doesn't need to throw an exception which will roll back the transaction. It may seem tedious to add the extra code to output what you want but if debugging isn't an option this will work.

Example code to illustrate what I mean...

Dim tracer As New StringBuilder
Try
    tracer.Append("running code ...")
    '// do some code here
    tracer.AppendLine("done")

    tracer.Append("running more code ...")
    '// do some code here
    tracer.AppendLine("done")

    '// Write out some info useful for debugging
    tracer.AppendLine(String.Format("value of variable 1 {0}", SomeVariable1))
Catch ex As Exception
    tracer.AppendLine(ex.ToString)
End Try

'// Create a new instance of the new custom error entity and save it
'// Where CustomError is the name of your new entity, assuming you're using strongly-typed entity classes
Dim ErrorObj As New CustomError With { 
    .UserName = "",
    .Message = tracer.ToString
    }

pluginOrgService.Create(ErrorObj)
answered on Stack Overflow Jun 21, 2017 by AK3800 • edited Jun 23, 2017 by AK3800
1

I've contacted MS support, exchanged emails with them for couple od days, even had a remote session with their support, then waited couple more days for their support to analyze problem, never got any solution from MS support, and at the end I overcome this by my own.

Problem here is with tool as I wanted to report to MS, but for some reason they are convinced that problem is with my custom code. I managed to narrow down this to one specific custom workflow that I made, lets call it Workflow_A. When plugin registration tool (PRT) try to get list of workflows from CRM (I used Fiddler, there is no order by in that request), Workflow_A was first in that list, PRT could not parse it and crashed. I then, deleted that workflow and recreated it again (same steps and conditions) and voila, it ended as last in workflows list and PRT stop crashing.

AK3800 stated

if my plugin does an http request I've seen that crash the PRT, I don't know for sure but it may be that the PRT doesn't allow that type of thing if it's debugging in a sandboxed environment.

I had to agree with him - PRT is making more problems then it solves (with debugging) so at the end I ended up filling my code with trace logs everywhere and no debugging, just making code changes based on trace logs.

answered on Stack Overflow Jul 3, 2017 by joksa
0

I'd open a support ticket with MS. They offer support for the SDK tools as well.

answered on Stack Overflow Jun 21, 2017 by Daryl

User contributions licensed under CC BY-SA 3.0