I've got a ScheduleActivity call within one of my CodeActivities which is returning immediately. The Activity it's scheduling is a Delay, with a Duration of 30 seconds, yet it returns immediately.
Here's some code:
protected override void CacheMetadata(NativeActivityMetadata metadata)
mDelay.Duration = TimeSpan.FromSeconds(30);
private bool DoRetryable(Func<bool> function, TimeSpan timeout, NativeActivityContext context)
bool result = false;
DateTime start = DateTime.Now;
while ((DateTime.Now - start) < timeout)
result = function();
private readonly Delay mDelay = new Delay();
My educational lectures on C# and .Net in general (ranging from beginner level topics to advanced topics):
The workflow engine schedule activities in unspecified execution order, this should be the reason you got unexpected behavior.
Basic Activity Scheduling in Workflow 4.0
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?