The error I am getting is
"The WorkflowApplication has been aborted because a Load or LoadRunnableInstance operation threw an exception. Create a new WorkflowApplication object to try loading another workflow instance."
I am using "workflowapplication" to run the workflow. The workflow instance I'm trying to load (there are a few of them) were created sometime ago and were persisted into the database.
Is there a way to find the exception that was actually thrown during Load or LoadRunnableInstance operation? I caught this error in the "aborted" event on the workflowapplication object, but it does not tell me the error that was thrown during load.
New addition
I stuck the following code in my web.config to get more details about the above exception:
<system.diagnostics>
<sources>
<source name="System.Activities.DurableInstancing" switchValue="Verbose">
<listeners>
<add name="textListener" />
<remove name="Default" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="textListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\Log\persistenceproblem.txt" traceOutputOptions="ProcessId, DateTime" />
</sharedListeners>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="textListener" />
</listeners>
</trace>
</system.diagnostics>
This pointed me to the exception
System.Activities.DurableInstancing Warning: 131075 : http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspxThrowing an exception. Source: System.Activities.DurableInstancing 4.0.0.0. Exception details: System.Runtime.DurableInstancing.InstancePersistenceCommandException: The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}LoadWorkflow was interrupted by an error. ---> System.Runtime.Serialization.SerializationException: The deserializer cannot load the type to deserialize because type 'System.Data.Entity.DynamicProxies.VacancyQuestionFormA_0A0432BFEF4023483E1B33251D8373454EAC6EDF2B2C6F312A4F606F45AF30E8' could not be found in assembly 'EntityFrameworkDynamicProxies-ConnectCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Check that the type being serialized has the same contract as the type being deserialized and the same assembly is used.
So now my issues is how to deal with Dynamic proxies that are being serialized. From what I've read, these are on demand so won't be guaranteed to be in the Dlls especially as we have multiple developers.
We already have clients that will have instances of the workflow with serialized Proxy classes.
My question now becomes: Is there a built in way for Windows Workflow to deal with Serialized Proxy classes more eloquently?
来源:https://stackoverflow.com/questions/39629243/trying-to-get-to-the-bottom-of-a-windows-workflow-4-5-issue