erikj

Like others playing with the WF bits, I have workflow types in assembly files not lying in the application search path. So, I have added an AssemblyResolve handler that loads assemblies stored in a special location (SQLServer, actually) as needed. Everything works fine until a workflow instance is reloaded from persistence.

In the SaveWorkflowInstanceState of my perisistence service, I call rootActivity.Save(myStream). Then in the LoadWorkflowInstanceState method, I call Activity.Load(myStream). I get an exception saying that the assembly containing the workflow type could not be located (the exact error is below). I assume .NET is going to disk to find the assembly because it's a FileLoadException.

I know the assembly is in the app domain already (I never stop the WF engine, for example), so why is the Activity deserializer going to disk Or is there something I've done wrong in the persistence service Thanks,

- Erik

[Exception Details...]

System.IO.FileLoadException was unhandled

Message="Could not load file or assembly 'wfscaletest, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"

Source="mscorlib"

FileName="wfscaletest, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null"

FusionLog=""

StackTrace:

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.Load(String assemblyString)

at System.UnitySerializationHolder.GetRealObject(StreamingContext context)

at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)

at System.Runtime.Serialization.ObjectManager.DoFixups()

at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)

at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity, IFormatter formatter)

at System.Workflow.ComponentModel.Activity.Load(Stream stream, Activity outerActivity)

at Epicor.Workflow.MemoryPersistenceSvc.LoadWorkflowInstanceState(Guid instanceId) in d:\maknet\AppDomainTest\WFHost\MemoryPersistenceService.cs:line 65

at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor)

at System.Workflow.Runtime.WorkflowRuntime.Load(Guid& key, CreationContext context)

at System.Workflow.Runtime.WorkflowInstance.TryUnload()

at Epicor.Workflow.WFHost.UnloadInstance(Object workflowInstance) in d:\maknet\AppDomainTest\WFHost\WFHost.cs:line 289

at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)




Re: Windows Workflow Foundation Resolving Assemblies in LoadWorkflowInstanceState

Tammy Miller

Epicor and Microsoft are collaborating on so many products now - ICE, Workflow, Hospitality, Sharepoint, CRM..... Epicor Support calls are being picked up in WA. Lots of Epicor jobs listed in Seattle area. One client really wants to switch from Epicor to Dynamics but for the cost to replace all the modules, we delayed a year in hopes that Microsoft will acquire Epicor. It is hard to sell Dynamics to my Epicor clients but they really suffering in limbo.




Re: Windows Workflow Foundation Resolving Assemblies in LoadWorkflowInstanceState

Saurabh Chechi - MSFT

Hi Erik,

Are you still stuck because of this problem






Re: Windows Workflow Foundation Resolving Assemblies in LoadWorkflowInstanceState

erikj

Thanks for the reply, Saurabh! The project was a prototype and I think I worked around the issue by not storing my assemblies in SQL Server. I haven't retried the scenario on the release WF bits, however. So, I am not stuck, but I'm curious if you have any further insight -- I intend to do more of this sort of work in an upcoming project. I can give you more background if you like.