Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7014199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:29:24+00:00 2026-05-27T22:29:24+00:00

I have a custom tracking service that has been running for a while now

  • 0

I have a custom tracking service that has been running for a while now with over 1500 live workflows ticking along, I’m now in the process of versioning the workflows so that I can release some change requests.

Unfortunately the system was not initially deployed with strongly typed assemblies, so I’m in the process of sorting this mess out.

I’m having to use a mixture of a custom SerializationBinder to translate the PublicKeyToken=null to my new PublicKeyToken, and a AppDomain_AssemblyResolve delegate to help point the host to the now strongly typed assemblies – Referenced here.

I’ve also had to replace the contents of the related rows within the [Type] table that comes with the default SqlTrackingService to reference the new PublicKeyToken, so:

some.namespace.foobar, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 

is replaced with:

some.namespace.foobar, Version=1.0.0.0, Culture=neutral, PublicKeyToken=123456789acb

I seemed to be making good progress, however when I transition my State Machine workflow, the Custom Tracking Service that I have added as a service is no longer firing for version 1.0.0.0 workflows, but is working for newly created version 2.0.0.0 workflows.

Note: The default SqlTrackingService is still running fine on both versions of the workflow, this is just a problem with the custom tracking service on existing persisted workflows.

The Custom Tracking Service has always been added through the app.config like this:

<Services>
       ...other services here...
      <add type="some.namespace.ActiveStateTrackingService, some.namespace.extensions" assembly="uk.gov.gsi.cma.extensions" />
</Services>

Any ideas on what else I need to change to get this working for the already existing workflows?

As requested, here is the custom tracking service, although the problem is to do with the host “binding” the custom tracking service, not the tracking service itself – I know this because in the instance where the custom tracking service isn’t fired, none of the methods, including the constructor get called.

  public class ActiveStateTrackingService : TrackingService
{
    protected override TrackingProfile GetProfile(Guid workflowInstanceId)
    {
        return GetDefaultProfile();
    }

    protected override TrackingProfile GetProfile(Type workflowType, Version profileVersionId)
    {
        return GetDefaultProfile();
    }

    protected override TrackingChannel GetTrackingChannel(TrackingParameters parameters)
    {
        return new ActiveStateTrackingChannel(parameters);
    }

    protected override bool TryGetProfile(Type workflowType, out TrackingProfile profile)
    {
        profile = GetDefaultProfile();
        return true;
    }

    protected override bool TryReloadProfile(Type workflowType, Guid workflowInstanceId, out TrackingProfile profile)
    {
        profile = null;
        return false;
    }

    private TrackingProfile GetDefaultProfile()
    {
        TrackingProfile profile = new TrackingProfile();
        profile.Version = new Version(1, 0);

        // Add tracking point for state activity executing
        ActivityTrackPoint statePoint = new ActivityTrackPoint();
        ActivityTrackingLocation location = new ActivityTrackingLocation(typeof(StateActivity), new ActivityExecutionStatus[] { ActivityExecutionStatus.Executing });
        statePoint.MatchingLocations.Add(location);
        profile.ActivityTrackPoints.Add(statePoint);

        return profile;
    }
}

public class ActiveStateTrackingChannel : TrackingChannel
{

    private TrackingParameters param;

    public ActiveStateTrackingChannel(TrackingParameters parameters)
    {
        param = parameters;
    }

    protected override void InstanceCompletedOrTerminated()
    {
        return;
    }

    protected override void Send(TrackingRecord record)
    {

        // get the tracking record and write out the name of the state.  
        var r = record as ActivityTrackingRecord;

        if (r != null)
            if (!string.IsNullOrEmpty(r.QualifiedName))
            {
                using (ICaseService caseService = new CaseService())
                    {
                        SomeServiceLayer.UpdateCurrentStateOutsideOfTheWorkflow(param.ContextGuid, r.ParentContextGuid, r.QualifiedName);
                        Console.WriteLine("*** Current State: {0} ***", r.QualifiedName);
                    }
            }                    
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:29:25+00:00Added an answer on May 27, 2026 at 10:29 pm

    It turns out that the final step is an easy one. The issue is a bug in WF and microsoft have outlined the answer here.

    You basically have to decorate your custom tracking service class with an attribute that allows you to resolve old tracking service references, like so:

    [System.Workflow.Runtime.Tracking.PreviousTrackingService("myNamespace.Workflow.StateMachineTrackingService, myNamespace.Workflow.StateMachineTracking, Version=1.2.0.1, Culture=neutral, PublicKeyToken=gr4b2191f58h9e0d")]
    public class StateMachineTrackingService : TrackingService
           {
             //Body of your custom tracking service here
           }
    

    Low and behold, my previously persisted workflows now resolve the new version of the Tracking Service.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a workflow that has a public State property that returns a custom
I work for an orginization that has a custom built Access/SQL Application running in
I have custom classes that I currently instantiate within App.xaml as resources. I want
I have a few models that need to have custom find conditions placed on
We have a product that we need to create an installer for. It has
I have a secure WCF service with custom authentication. When I am stress testing
I have created a custom control using VB.NET in Visual Studio 2008 that gives
Here is my problem. I have a ticket-tracking system that is not very 'user
I know this has been discussed ad nauseum...but I have an issue with the
We have written an Outlook add-in in C#, that appends a custom header to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.