Event "SetData" cannot be delivered

Topics: Web Client Software Factory, User Forum
Apr 25, 2007 at 10:14 AM
Hi

we are having problems with storing data into page flow. Below are marked lines where we get error: *Event "SetData" on interface type "Microsoft.Practices.PageFlow.WorkflowFoundation.IDataExchangeService"
for instance id "d9ab1da9-7b69-4cd6-952a-bb036eb7216d" cannot be delivered.*.

BaseController<TType, TPageFlowType>
    private IPageFlow pageFlow;
    private IPageFlowProvider pageFlowProvider;
 
    [ProviderDependency(typeof(PageFlowDirectory))]
    public IPageFlowProvider PageFlowProvider
    {
      get { return pageFlowProvider; }
      set { this.pageFlowProvider = value; }
    }
 
    public IPageFlow PageFlow
    {
      get 
      { 
        if (this.pageFlow == null)
        {
          this.pageFlow = pageFlowProvider.GetPageFlow(typeof(TPageFlowType));
        }
        return this.pageFlow;
      }
    }
    
    /* ... */
    
    public TType ObjectDefinition
    {
      get
      {
        if (this.PageFlow.UserData.Contains("ObjectDefinition"))
        {
          return (TType)this.PageFlow.UserData["ObjectDefinition"];
        }
        return null;
      }
      set
      {
        if (value != null)
        {
-->          this.PageFlow.UserData["ObjectDefinition"] = value;
        }
        else if (this.PageFlow.UserData.Contains("ObjectDefinition"))
        {
          this.PageFlow.UserData.Remove("ObjectDefinition");
        }
      }
    }

DataExchangeService.cs
		public void Set(Guid instanceId, string key, object value)
		{
			if (SetData != null) 
-->			  SetData(this, new SetDataEventArgs(instanceId, key, value));
		}

We have five controllers which uses already mentioned base controller. Each controller has its own page flow type. Only one controller produces forementioned error. All controllers and page flows are basically the same, but I cannot figure out what causes this error.

What can cause this error? Any suggestions?

Any help will be greatly appreciated.

Best regards
Igor
Apr 25, 2007 at 1:17 PM
This error is caused in because somehow your app is calling PageFlow.UserData"" = ".." sometime after the pageflow has been completed/terminated.

Matias
http://staff.southworks.net/blogs/matiaswoloski
Apr 25, 2007 at 1:37 PM

matiaswoloski wrote:
This error is caused in because somehow your app is calling PageFlow.UserData"" = ".." sometime after the pageflow has been completed/terminated.

Matias
http://staff.southworks.net/blogs/matiaswoloski


PageFlow.Status is set to Running if I check it before calling PageFlow.UserData

Igor.
Apr 25, 2007 at 4:54 PM
Can you narrate what is the sequence of actions that occurs on the failing controller?
Thanks
Matias
Apr 26, 2007 at 10:01 AM
Some background. This is ajax application. Each page has its own pageflow. Pageflow is currently used only for persisting state. We are using view-presenter concept also on UserControls.

We've customized following classes:
- page flow correlation token provider
- navigation service
- sitemapprovider which adds basic support for building "dynamic" sitemaps

When user opens new page:
(page presenter)
1. new page flow instance is created (we have custom correlation token provider which creates new token for each new page)
2. page flow instance is started
3. ID (Guid) which is given by url is stored into page flow state
4. dynamic loading of user control

(usercontrol presenter)
5. get data from WCF application and push it to user control

Till now all is going on fine. When user makes some changes on control and then saves data:
(page)
1. User control is loaded
(usercontrol presenter)
2. user control's data is stored into page flow state (this is the place where error happens, page flow instance status is: Running)
(page presenter)
3. get changes from page flow state and save it (WCF application)

For building up UserControl's presenter we've implemented base class which on init event starts "building strategy" (CompositionContainer.BuildItem) and on unload fires PageBuilder.TearDown.

We've five pages which uses same concept described above. Only one page produces error. On each request we have two presenters (page and usercontrol) which uses same controller (and also page flow).

I hope I provided enough details.

Regards,
Igor
Apr 26, 2007 at 4:24 PM
Hi Igor,
The problem could be caused if the object you are trying to store is not marked as Serializable.
EventDeliveryFailedException often provides an inner exception with more specific information on the error. Check this inner exception if the problem is not the Serializable attribute, and post it here so we can help.
Please let me know if this helps,

Julián Domínguez
http://staff.southworks.net/blogs/jdominguez
May 3, 2007 at 9:08 AM
Edited May 3, 2007 at 9:09 AM
Hi,

back from vacation... Yea - inner exception had more specific info about error. As you mentioned, one of the classes was not marked as Serializable. Thank you all for your help.

Best regards
Igor
Dec 1, 2007 at 11:19 AM
Hi,

I am developing an application where-in there is only one webpage called default.aspx. In the page there is different placeholders which potentially will be filled with user-controls depending upon the kind of module user is requesting to contribute to the page. Is there any way to implement page flow kind of thing with user controls so that rights and priviledges of specific kind of user can be maintained in the application.

Thanks & Regards
Abhijit