Workflow Foundation state serialization and VS upgrade.

Mizokunimito 1 Reputation point
2022-01-14T18:06:24.4+00:00

Hi,

we use WF as engine on our product we're experiencing an issue that prevent us to move one project of the entire solution to be built with VS2017 obling us to compile it with VS2012.

Infact when WF tries to load persisted workflows if the mentioned assembly is built against VS2017 it raises a deserialization exception.

The reason is because when workflow should restart needs a callback to invoke and its name is part of persisted state.

As you can see below the same code on the same workflow produces differente serialization depending on the VS version used. (VS2012 is on the left)

165197-diffstate.png

The callback name is made by compiler when we attach an handler to a framework delegate,

In the following test project screen you can see a compiler create special methods if you have a delegate signature with an object argument and the handler argument is strong typed this happens since compiler made a special method that wraps the handler with a cast object to required type.

165090-vside.png
These special methods naming convention changed from VS2012 to VS2017 so basically WF doesn't find the method in the persisted state when workflow restarts.

Some ideas/attempts:

1) Look for some option compiler to build specific project with VS2017 to have backward compatibility , but we dint't find nothing yet.

2) Try to add method with legacy name this can be done with dynamic method, but it will be created in a general scope e not as part of the original object persisted in the state.

3) Update the wf state with a kind of updater to be compliant with VS2017, however the state is compressed in a binary format and is not easy to do and at the same time exposes to risks.

Any advice will be appreciated.

Thanks

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
36,170 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 25,801 Reputation points Microsoft Vendor
    2022-01-17T08:37:01.597+00:00

    Hi @Mizokunimito ,

    Your issue is more related to Windows Workflow Foundation and is currently not supported in the Microsoft Q&A, the supported products are listed over here: https://learn.microsoft.com/en-us/answers/products/ (more to be added later on).

    You can ask in the dedicated Windows Workflow Foundation forum over here:
    https://developercommunity.visualstudio.com/report?space=8&entry=problem

    Thanks for your understanding.

    Sincerely,
    Anna
    *
    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments