Feb 9 2008

Event "XXX" on interface type "XXX" for instance id "XXX" cannot be delivered.

Category: WF | Windows Workflow FoundationBil@l @ 11:16

If you working with Windows Worflow Foundation and it happens that you get such an exception, add a try/catch exception on the event that the host is firing and check the innerException message.

I am working on a WF application and had this exception today, I checked the InnerException object and found this message:

Cannot access a disposed object.
Object name: 'WorkflowRuntime'.

 

This message shows that the WorkflowRuntime object has expired or timed out. This means that something happened in the WF that caused the WorkflowRuntime to terminate. Now the WorkflowRuntime has terminated and no more able to handle any interaction betwen the host/WF or WF/host.

 

Before telling you what was wrong in my WF, I was building a State-Machine Workflow, first step to do usually is draw all the States in your WF, then to each State add the set of events each State shall be waiting on. Usually, when you drag an EventDrivenActivity into a State and double click on that EventDrivenActivity, it gives you a compilation error saying that:

The first 'EventDrivenActivity' child should implement 'System.Workflow.Activities.IEventActivity', such as 'HandleEventActivity' ....

 

Now when you compile your WF project it will give you a compilation error. To resolve this issue and continue working on your WF in a step-by-step, I usually add a DelayActivity. This will make the WF satisfied, and when it is time to handle the details of the State, I remove the DelayActivity and add whatever activities I want.

Now back to what was happening today with me, I had a state with 3 eventdriven activities as follows:

State

 

I was trying to test PreviousClickedEvent eventdriven activity, NextClickedEvent2 was already handled, and what was left is FinishClickedEvent. Going back to what I mentioned above, I had a DelayActivity placed inside with "00:00:00". So what was happening is that, I was trying to handle the PreviousClickedEvent but the WF was timing out by the DelayActivity in the FinishedClickedEvent and that is why I was getting the above exception.

To remedy this situation, I increaed the timeout of the DelayAcitivity to maintain the compilation correctness of the unfinished parts of the Workflow and that was it!

 

Hope this post helps you,
regards

Tags: ,