Reputation: 6265
I'm really struggling with a very unusual problem here. We've just upgraded our dev stack to Visual Studio 2012 / .NET 4.5.
We want to upgrade to the latest version of Workflow Foundation (4.5), which means upgrading the SQL workflow instance store schema as well, so that we can use new features such as side-by-side versioning.
First I started by running the schema upgrade script installed with .NET 4.5 at: C:\Windows\Microsoft.NET\Framework\v4.0.30319\SQL\en\SqlWorkflowInstanceStoreSchemaUpgrade.sql
Then I ran my workflow tests, and everything worked fine.
Next step was to incorporate the schema and data changes into our SQL Server Database Project (the new one in VS 2012) so that these changes will build and deploy automatically as part of our build process.
I did a schema compare from the updated database instance to the database project, which identified and imported all the schema changes, and I updated our reference data scripts so that the SqlWorkflowInstanceStoreVersion table had the correct values.
I then published the project, which meant the target database was dropped, re-created, and populated with default reference data (including the store version row).
I ran my workflow tests again, and this time the workflow tests all timed out waiting for the workflow thread to return. The PersistableIdle handler gets called to Unload, but the Unloaded handler never gets called, so something is screwing up in between now.
It's obviously to do with the fact that the database is re-created, but I cannot see any differences using the Schema Compare tool in VS 2012.
We can't go any further with WF 4.5 features until we can fix this problem, does anyone have any idea what might be going on here?
Upvotes: 3
Views: 895
Reputation: 548
Not sure if you found a solution, but I thought the following information may help other people with upgrade woes.
This MSDN article hints at one of the issues with upgrading in-place: What's New in Windows Workflow Foundation in .NET 4.5
The new Windows Workflow Foundation features introduced in .NET Framework 4.5 are not available for projects that target previous versions of the framework. If a project that targets .NET Framework 4.5 is re-targeted to a previous version of the framework, several issues can occur.
C# expressions will be replaced in the designer with the message Value was set in XAML.
Many build errors will occur, including the following error.
The file format is not compatible with current targeting framework. To convert the file format, please explicitly save the file. This error message will go away after you save the file and reopen the designer.
Upgrading the SQL persistence store seems to make it so the workflow has to be recompiled targeting .Net 4.5 or it hangs trying to communicate with the persistence store now that it supports versioning.
It may not be necessary in your case, but we had to also create update maps to "upgrade" the activity definitions and running instances. MSDN provides a lengthy article on this here: How to: Update the Definition of a Running Workflow Instance
And the Dynamic update reference was also useful: Dynamic Update
It was a pretty involved process, but afterwards everything began working again.
You may also find this useful: How to: Host Multiple Versions of a Workflow Side-by-Side
Upvotes: 1