How to debug a SharePoint 2013 CodeActivity?

799 views Asked by At

solved - see update below...

  1. I created the activity in a separate workflow activity project
  2. In my SharePoint project I added a reference to the activities project
  3. I also included the activities project's output to the SharePoint package (deploy to GAC)
  4. Next in my SharePoint project I created a pre-deployment msbuild action to copy my activities dll to the workflow manager directories (activities and WFWebRoot\bin).
  5. Of course I also put an "AllowedTypes.xml" in the two relevant directories.
  6. I did not automate restarting the workflow manager backend service. I believe I only need to restart it if the .xml file has changed, right? Or any time my activities.dll changes?

Now my problem is I cannot debug my workflow CodeActivity. The workflow works just fine and attaching to the workflow.servicehost.exe I can debug my workflow in visual studio - it hits breakpoints on any declarative workflow activity. Unfortunately any break point in my custom CodeActivity is not being hit :(

Any idea? Obviously I have SharePoint and Workflow Manager running on the same machine. I'm not sure why deploying the activities dll to GAC is required - and iisreset?! (See this technet article)

UPDATE: Some lessons learned...

  1. Do stop WorkflowServiceBackend before deployment (I'm using the build event).
  2. Start the WorkflowServiceBackend again on post-deployment event.
    Otherwise the workflow service may block access to the GAC'ed activities assembly and it will not be replaced. It happened to me. Now as you (should) know any GAC'ed assembly is always prefered over any "local" assembly. And obviously the workflow service used my GAC assembly - do I still need to copy my activities assembly to artifcats and wfwebroot\bin? NO. I deleted my dlls from the workflow manager directories and I was still able to both execute and debug my workflow activities without any hazzle.
0

There are 0 answers