views:

256

answers:

0

I am building a application that uses Workflow Foundation (WF). For various reasons I have to use a custom tracking profile that I generate programmatically by using the following method:

  • Instantiate the workflow.
  • Retrieve the corresponding tracking profile.
  • Test whether the tracking profile is up to date (I use a version number for that).
  • If not up to date, generate a new profile.
  • Update the profile in the database.
  • Force the runtime to update the profile by calling ReloadTrackingProfiles() on the workflowinstance.

Unfortunately, the tracking profile is not updated and the first time, it runs, it still uses the default profile. For the second time it executes, everyting is ok.

I tried to generate the instance only after I upgraded the tracking profile, but unfortunately I need a workflow instance to generate the profile. I could destroy the workflow instance and instantiate a new one after I generated the tracking profile, but that would still leave me wondering why the approach above doesn't work.

Does anybody have a clue?