Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - WWF Workflow changes committed but Activity.Execute() not called

Reply
 
Old 01-26-2009   #1 (permalink)
Bill Richards


 
 

WWF Workflow changes committed but Activity.Execute() not called

I have the following sequence activity within a Sequential Workflow

// delegate for OnLoadFilters event
public delegate void LoadFiltersEventHandler();

public partial class DynamicFilteringActivity : SequenceActivity
{
public event LoadFiltersEventHandler OnLoadFilters;

protected override ActivityExecutionStatus
Execute(ActivityExecutionContext executionContext)
{
if(null != OnLoadFilters)
{
LogWriter.Trace("DynamicFilteringActivity::Loading
filters");
OnLoadFilters();
}
return (base.Execute(executionContext));
}
}


When this Activity is run, as you can see it simply raises the OnLoadFilters
event, which is registered with the SequentialWorkflowActivity thus

// in SequentialWorkflowActivity's designer.cs file
this.FilteringSequence.OnLoadFilters += new
e3.net.interfacing.activities.LoadFiltersEventHandler(this.OnLoadFilters_ExecuteCode);

// in SequentialWorkflowActivity's .cs file
private void OnLoadFilters_ExecuteCode()
{
// code ellided for the sake of berevity.
// suffice it to say however, that DynamicFilterLoader, takes a
few parameters and does the actual
// business of adding the Activities to the Workflow

DynamicFilterLoader.LoadFilters(ref workflowChanges,
MessageSystem.MessageType, messagePath);

try { ApplyWorkflowChanges(workflowChanges); }
catch(InvalidOperationException ex)
{
// log error
LogWriter.Exception(ex);
throw;
}
catch(WorkflowValidationFailedException wvfe)
{
LogWriter.Exception(wvfe);
var sb = new StringBuilder();
foreach(ValidationError error in wvfe.Errors)
sb.AppendLine(error.ErrorText);

LogWriter.Trace(sb.ToString());
throw;
}
}

One of these "Filters" which is loaded at runtime, for example is
FilterGender, whose constructors are defined as follows:

[System.Diagnostics.DebuggerStepThrough]
public FilterGender() { InitializeComponent(); }

[System.Diagnostics.DebuggerStepThrough]
public FilterGender(string gender, MessageResponses response) :
base(response)
{
Genders = new List<string>();
Genders.AddRange(gender.Split(new[] { ',' },
StringSplitOptions.RemoveEmptyEntries));

LogWriter.FilterRelatedTracing(string.Format("FilterGender::FilterGender(\"{0}\",
{1}) constructed ... ", gender, response));
}

So far so good, when the workflow is run, the approriate logic is used to
determine whether or not our dynamic filters are required and the
appropriate filter is indeed added to the workflow, this much is evident in
the fact that our Trace file contains the expected trace
"FilterGender::FilterGender(\"{0}\", {1}) constructed ... ", also when the
DebuggerStepThrough attribute is commented out and we run the workflow in
debug mode, we can set a breakpoint in the constructor.

The problem is however, that although no exceptions are raised when the call
to ApplyWorkflowChanges(workflowChanges); is made, the Execute method of
the dynamically loaded filter is never called.

If there is not enough information here let me know and I will provide more.

Thanks in advance.


My System SpecsSystem Spec
Old 01-26-2009   #2 (permalink)
Bill Richards


 
 

Re: WWF Workflow changes committed but Activity.Execute() not called

Having discovered that the flaw actually lies in the ellided code that's
doing the adding to the workflow, this post has become somewhat redundant.

Thanks.

"Bill Richards" <bill.richards@xxxxxx> wrote in message
news:8E2AEF3C-E875-454E-86D7-E1A92246CE92@xxxxxx
Quote:

>I have the following sequence activity within a Sequential Workflow
>
> // delegate for OnLoadFilters event
> public delegate void LoadFiltersEventHandler();
>
> public partial class DynamicFilteringActivity : SequenceActivity
> {
> public event LoadFiltersEventHandler OnLoadFilters;
>
> protected override ActivityExecutionStatus
> Execute(ActivityExecutionContext executionContext)
> {
> if(null != OnLoadFilters)
> {
> LogWriter.Trace("DynamicFilteringActivity::Loading
> filters");
> OnLoadFilters();
> }
> return (base.Execute(executionContext));
> }
> }
>
>
> When this Activity is run, as you can see it simply raises the
> OnLoadFilters event, which is registered with the
> SequentialWorkflowActivity thus
>
> // in SequentialWorkflowActivity's designer.cs file
> this.FilteringSequence.OnLoadFilters += new
> e3.net.interfacing.activities.LoadFiltersEventHandler(this.OnLoadFilters_ExecuteCode);
>
> // in SequentialWorkflowActivity's .cs file
> private void OnLoadFilters_ExecuteCode()
> {
> // code ellided for the sake of berevity.
> // suffice it to say however, that DynamicFilterLoader, takes a
> few parameters and does the actual
> // business of adding the Activities to the Workflow
>
> DynamicFilterLoader.LoadFilters(ref workflowChanges,
> MessageSystem.MessageType, messagePath);
>
> try { ApplyWorkflowChanges(workflowChanges); }
> catch(InvalidOperationException ex)
> {
> // log error
> LogWriter.Exception(ex);
> throw;
> }
> catch(WorkflowValidationFailedException wvfe)
> {
> LogWriter.Exception(wvfe);
> var sb = new StringBuilder();
> foreach(ValidationError error in wvfe.Errors)
> sb.AppendLine(error.ErrorText);
>
> LogWriter.Trace(sb.ToString());
> throw;
> }
> }
>
> One of these "Filters" which is loaded at runtime, for example is
> FilterGender, whose constructors are defined as follows:
>
> [System.Diagnostics.DebuggerStepThrough]
> public FilterGender() { InitializeComponent(); }
>
> [System.Diagnostics.DebuggerStepThrough]
> public FilterGender(string gender, MessageResponses response) :
> base(response)
> {
> Genders = new List<string>();
> Genders.AddRange(gender.Split(new[] { ',' },
> StringSplitOptions.RemoveEmptyEntries));
>
>
> LogWriter.FilterRelatedTracing(string.Format("FilterGender::FilterGender(\"{0}\",
> {1}) constructed ... ", gender, response));
> }
>
> So far so good, when the workflow is run, the approriate logic is used to
> determine whether or not our dynamic filters are required and the
> appropriate filter is indeed added to the workflow, this much is evident
> in the fact that our Trace file contains the expected trace
> "FilterGender::FilterGender(\"{0}\", {1}) constructed ... ", also when the
> DebuggerStepThrough attribute is commented out and we run the workflow in
> debug mode, we can set a breakpoint in the constructor.
>
> The problem is however, that although no exceptions are raised when the
> call to ApplyWorkflowChanges(workflowChanges); is made, the Execute
> method of the dynamically loaded filter is never called.
>
> If there is not enough information here let me know and I will provide
> more.
>
> Thanks in advance.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Windows Workflow - Jump to Activity .NET General
Are sub-routines parameters called by reference or called by value? VB Script
Execute error: Type Mismatch: 'Execute' VB Script


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46