SharePoint 2013 Workflow Deployment Errors

I was recently working with some of the new capabilities in workflow with SharePoint 2013.  I was able to easily create some very simple workflows that read item properties and set them, but then as my workflow increased in complexity I hit an error.  I was getting a deployment error in the output pane within Visual Studio.  Four of them actually that all read the same.,  The error is shown below.

  @"Error 1
        CorrelationId: da069aa0-8f5a-4120-b5ac-1647ca6c0fe3
        ErrorDetail: There was a problem with activating the app web definition.
        ErrorType: App
        ErrorTypeName: App Related
        ExceptionMessage: System.InvalidOperationException: Microsoft.Workflow.Client.ActivityValidationException: Workflow XAML failed validation due to the following errors:
Cannot set unknown member 'LookupSPListItemStringProperty.ItemId'. HTTP headers received from the server - ActivityId: 0757f2f2-5e4b-43c2-904a-bc8ff92bef71. NodeId: SP2013-DEV-SP. Scope: /SharePoint/default/161fba91-758c-48f3-b2c0-b74fe5c3a3e6/d46f3422-9442-4de5-92c9-e7a516755aac. Client ActivityId : da069aa0-8f5a-4120-b5ac-1647ca6c0fe3. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at Microsoft.Workflow.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at Microsoft.Workflow.Client.HttpGetResponseAsyncResult`1.End(IAsyncResult result)
   at Microsoft.Workflow.Client.ClientHelpers.SendRequest[T](HttpWebRequest request, T content)

I was really confused because the ItemId property of LookupSPListITemProperty is not required.  So why is my deployment trying to set it and why is that causing my deployment to fail?  I went back to the simple workflows that I had put together and redeployed those just to make sure something in my environment didn’t change.  I noticed that a console application, specifically c:\Program Files (x86)\Workflow Manager Tools\1.0\Microsoft.Workflow.TestServiceTest.exe, was being launched as part of deployment.  This wasn’t happening in my other project.

In the Visual Studio project properties there is a SharePoint tab that provides a checkbox to allow workflow debugging.  See screenshot below. 

image

This wasn’t checked in my project, but was for my other ones.  Checking that allowed me to deploy my application, but didn’t help though, the Microsoft.Workflow.TestServiceTest.exe module was still not loading.  I navigated to the Microsoft.Workflow.TestServiceTest.exe application and started it As an Administrator manually.  As long as I left that running I could deploy and test my workflows and as I ran them began seeing the workflow instance ID and other details logged to the console.

image

Problem once again averted, although it took more than a few hours to figure out what was going on here.