Custom Workflow Activity -- Unable to create new WorkflowInstance for WorkflowDefinition [guid]
Hi, I have created a custom workflow activity, roughly following the Ensynch guide found here: http://ilm2wfactivity.codeplex.com/releases/view/20188 I created a workflow which includes my new custom activity, and an MPR to trigger it. The problem is, the custom activity is not executed. In the request object, it gives the following error in the request status details: Unable to create new WorkflowInstance for WorkflowDefinition '66c5897b-cd71-4079-bc0c-2ed2b428c5a4'. In the event log on the fim server, the following errors (3) were found: WorkflowManager could not deserialize XOML definition: '<ns0:SequentialWorkflow x:Name="SequentialWorkflow" ActorId="00000000-0000-0000-0000-000000000000" WorkflowDefinitionId="00000000-0000-0000-0000-000000000000" RequestId="00000000-0000-0000-0000-000000000000" TargetId="00000000-0000-0000-0000-000000000000" xmlns:ns1="clr-namespace:FimCustomActivityLibrary;Assembly=FimCustomActivityLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8fa3b4f0cdc6d132" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ns0="clr-namespace:Microsoft.ResourceManagement.Workflow.Activities;Assembly=Microsoft.ResourceManagement, Version=4.0.2587.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <ns1:CustomActivity x:Name="authenticationGateActivity1" /> </ns0:SequentialWorkflow>'. Microsoft.ResourceManagement.Workflow.Hosting.WorkflowManagerException: Unable to create new WorkflowInstance for WorkflowDefinition '66c5897b-cd71-4079-bc0c-2ed2b428c5a4'. ---> System.Workflow.ComponentModel.Compiler.WorkflowValidationFailedException: The workflow failed validation. at System.Workflow.Runtime.Hosting.DefaultWorkflowLoaderService.CreateInstance(XmlReader workflowDefinitionReader, XmlReader rulesReader) at System.Workflow.Runtime.WorkflowDefinitionDispenser.LoadRootActivity(String xomlText, String rulesText, Byte[] xomlHashCode, Boolean createDefinition, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowDefinitionDispenser.MruCache.GetOrGenerateDefinition(Type type, String xomlText, String rulesText, Byte[] md5Codes, Boolean initForRuntime, Boolean& exist) at System.Workflow.Runtime.WorkflowDefinitionDispenser.GetRootActivity(String xomlText, String rulesText, Boolean createNew, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance) at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance) at System.Workflow.Runtime.WorkflowRuntime.GetWorkflowExecutor(Guid instanceId, CreationContext context) at System.Workflow.Runtime.WorkflowRuntime.InternalCreateWorkflow(CreationContext context, Guid instanceId) at System.Workflow.Runtime.WorkflowRuntime.CreateWorkflow(XmlReader workflowDefinitionReader, XmlReader rulesReader, Dictionary`2 namedArgumentValues, Guid instanceId) at Microsoft.ResourceManagement.Workflow.Hosting.WorkflowManager.StartWorkflowInstance(Guid workflowInstanceIdentifier, KeyValuePair`2[] additionalParameters) Microsoft.ResourceManagement: Microsoft.ResourceManagement.Workflow.Hosting.WorkflowManagerException: Unable to create new WorkflowInstance for WorkflowDefinition '66c5897b-cd71-4079-bc0c-2ed2b428c5a4'. ---> System.Workflow.ComponentModel.Compiler.WorkflowValidationFailedException: The workflow failed validation. at System.Workflow.Runtime.Hosting.DefaultWorkflowLoaderService.CreateInstance(XmlReader workflowDefinitionReader, XmlReader rulesReader) at System.Workflow.Runtime.WorkflowDefinitionDispenser.LoadRootActivity(String xomlText, String rulesText, Byte[] xomlHashCode, Boolean createDefinition, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowDefinitionDispenser.MruCache.GetOrGenerateDefinition(Type type, String xomlText, String rulesText, Byte[] md5Codes, Boolean initForRuntime, Boolean& exist) at System.Workflow.Runtime.WorkflowDefinitionDispenser.GetRootActivity(String xomlText, String rulesText, Boolean createNew, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance) at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext context, WorkflowInstance workflowInstance) at System.Workflow.Runtime.WorkflowRuntime.GetWorkflowExecutor(Guid instanceId, CreationContext context) at System.Workflow.Runtime.WorkflowRuntime.InternalCreateWorkflow(CreationContext context, Guid instanceId) at System.Workflow.Runtime.WorkflowRuntime.CreateWorkflow(XmlReader workflowDefinitionReader, XmlReader rulesReader, Dictionary`2 namedArgumentValues, Guid instanceId) at Microsoft.ResourceManagement.Workflow.Hosting.WorkflowManager.StartWorkflowInstance(Guid workflowInstanceIdentifier, KeyValuePair`2[] additionalParameters) --- End of inner exception stack trace --- at Microsoft.ResourceManagement.Utilities.ExceptionManager.ThrowException(Exception exception) at Microsoft.ResourceManagement.Workflow.Hosting.WorkflowManager.StartWorkflowInstance(Guid workflowInstanceIdentifier, KeyValuePair`2[] additionalParameters) So it appears that the workflow is not being deserialized properly, and is failing validation. I'm just not sure what to do with that information. Anyone have any ideas what I might be doing wrong, or where I should look for more clues? Thanks, Mark
February 23rd, 2010 10:44pm

what's your AuthN Activity like? mind posting some sample code?The FIM Password Reset Blog http://blogs.technet.com/aho/
Free Windows Admin Tool Kit Click here and download it now
February 24th, 2010 10:07am

btw, how did u generate the xoml? manually? or using the WF Designer in FIMPortal would u try editing that workflow so the xoml is regenerated? bad things might happen if u recompile, update the dll but forget to update the xomlThe FIM Password Reset Blog http://blogs.technet.com/aho/
February 24th, 2010 1:58pm

Hi Anthony, thanks for your replies. I tried the workflow activity on another FIM install (update 2) and it worked, which gave me a clue. The server where it wasn't working was running update 3. The problem was solved by removing the FIM dll references in my project, extracting the (update 3) dlls from the MicrosoftILMPortalCommonDlls.wsp , and referencing those in my project instead. Thanks, Mark
Free Windows Admin Tool Kit Click here and download it now
February 25th, 2010 6:46pm

probably because you are linking against different version of the dll and the binding redirection is missing... Side question for you... Why would you want to write your own AuthenticateGateActivity but not just a AuthenticationGate? I am not even sure if it's possible if you can really write your own AuthN Gate Activity. It looks extremely hard to me to mimic the existing gate so that the client knows how to interact with the activity -AnthonyThe FIM Password Reset Blog http://blogs.technet.com/aho/
February 26th, 2010 12:00am

I'm actually not writing my own AuthenticateGateActivity, I'm not sure why it's named that way in the XOML.
Free Windows Admin Tool Kit Click here and download it now
March 3rd, 2010 4:33pm

Just as an added note, if you are running into the 'Unable to create new WorkflowInstance for WorkflowDefinition' issue, and you're using network load balancing for the servers running the Fim Service, make sure that each server in the cluster has the correct and updated assembly installed in the GAC. Otherwise, you'll see the error whenever the server(s) are accessed which aren't using the correct version.
April 1st, 2010 3:00pm

I've also been able to repro this error message when I build the WF assembly using references that point to outdated FIM assemblies. So if I build my FIM WF Activity DLL then GAC it on the FIM Service box, FIM will fail to load my DLL because it can't resolve the reference.CraigMartin Edgile, Inc. http://identitytrench.com
Free Windows Admin Tool Kit Click here and download it now
February 26th, 2011 8:07am

when you patch the portal/fimservice, the patch should add binding redirection for certain assemblies to avoid that issue. Would you double check your web.config or service config to see if you have the binding redirection?
February 26th, 2011 8:29am

Hi Anthony, this is a fresh install. No binding redirects found in Microsoft.ResourceManagement.Service.exeCraigMartin Edgile, Inc. http://identitytrench.com
Free Windows Admin Tool Kit Click here and download it now
February 26th, 2011 8:45am

We only provide MSI for RTM. Any post-RTM fixes would be a patch. Since you said you were referencing older version of ResourceManagement.dll, that implies it's a pre-RTM dll that your custom activity is linking with?
February 26th, 2011 8:47am

Craig, Have you selected to reference the FIM assemblies using a "Specific Version" that's an option for your assembly reference? In that case you could probably get this problem... //HenrikHenrik Nilsson, ILM/FIM MVP Blog: http://www.idmcrisis.com Company: Cortego (http://www.cortego.se)
Free Windows Admin Tool Kit Click here and download it now
February 26th, 2011 8:54am

Side question for you... Why would you want to write your own AuthenticateGateActivity but not just a AuthenticationGate? I am not even sure if it's possible if you can really write your own AuthN Gate Activity. It looks extremely hard to me to mimic the existing gate so that the client knows how to interact with the activity -Anthony The FIM Password Reset Blog http://blogs.technet.com/aho/ The way the designer seems to work is that every activity is an "authenticationGate1". I'm not sure how to explicitly name them short of editing the XOML. This bubbles up when you're debugging as well.My Book - Active Directory, 4th Edition My Blog - www.briandesmond.com
February 26th, 2011 8:57am

Thanks for the replies; I know how I got myself into this problem ;-). Just updating the thread in case anybody else has moments as numb as me! Basically incorrect assembly references can lead to the deserialization error. The fix options in my case are: fix my assembly references manually add the binding redirects to the FIM Service config file apply the patch instead of using the installation media that I did CraigMartin Edgile, Inc. http://identitytrench.com
Free Windows Admin Tool Kit Click here and download it now
February 26th, 2011 9:00am

Side question for you... Why would you want to write your own AuthenticateGateActivity but not just a AuthenticationGate? I am not even sure if it's possible if you can really write your own AuthN Gate Activity. It looks extremely hard to me to mimic the existing gate so that the client knows how to interact with the activity -Anthony The FIM Password Reset Blog http://blogs.technet.com/aho/ The way the designer seems to work is that every activity is an "authenticationGate1". I'm not sure how to explicitly name them short of editing the XOML. This bubbles up when you're debugging as well. My Book - Active Directory, 4th Edition My Blog - www.briandesmond.com known bug. (didn't notice it 1yr ago)
February 26th, 2011 9:04am

Side question for you... Why would you want to write your own AuthenticateGateActivity but not just a AuthenticationGate? I am not even sure if it's possible if you can really write your own AuthN Gate Activity. It looks extremely hard to me to mimic the existing gate so that the client knows how to interact with the activity -Anthony The FIM Password Reset Blog http://blogs.technet.com/aho/ The way the designer seems to work is that every activity is an "authenticationGate1". I'm not sure how to explicitly name them short of editing the XOML. This bubbles up when you're debugging as well. My Book - Active Directory, 4th Edition My Blog - www.briandesmond.com known bug. (didn't notice it 1yr ago) My bad. I totally missed the year on this thread.My Book - Active Directory, 4th Edition My Blog - www.briandesmond.com
Free Windows Admin Tool Kit Click here and download it now
February 26th, 2011 9:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics