BUG in System.Workflow.ComponentModel.Activity class?

Hi All,

I have posted a problem inhttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=586644&SiteID=1 ,but I’m still looking for a solution.

I’m creating a workflow generator system and I’m using CodeDom to generate the workflow files (.cs, .designer.cs) andWorkflowMarkupSerializerto generate the .rules file.

If I put the generated files into solution and compile them, my workflow works perfectly, but if I compile them in runtime and insert the generated Assembly into TypeProvider dinamically, the workflow executes some steps and generates a Deserialization error.

I used a reflector in WWF Activity class and analyzing the stackStrack, I saw that the error occurred in Load method when the WWF tried to deserialize an Activity.

Activity class generated by reflector:

...

try

{

if (outerActivity != null)

{

Activity.FillContextIdToActivityMap(outerActivity.RootActivity);

}

activity1 = (Activity) formatter.Deserialize(stream);

Queue<Activity> queue1 = new Queue<Activity>();

I turn off the SQLPersistence and the error continues. Both my workflow and my delegates use the Serializable attributes.

I’m thinking that can be an error in Activity class.

Any suggestions?

Thanks in advance

[4465 byte] By [AndrDias] at [2007-12-22]
# 1
What is the exception?
JonFlanders at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

have you tried adding an assembly resolve event handler in a way like:

in constructor sink up the event:

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

in the event handler:

if (yourAssembly.FullName == args.Name)

return yourAssembly;

sergey.chub at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

Hi All,

The problem with deserialization occurred because I was generating the assembly with workflow files in memory and in moment of deserialization the .net framework was looking for the assembly in \bin or \system32 directory.

I resolved the problem generating the assembly in a specific directory and using .net probing feature to specify the assemblies directory.

But, I still thing that WWF should be intelligent to know the original path that the assembly was loaded :-)

Thanks

Andr Dias

AndrDias at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified