Event cannot be delivered

We have developed a workflow application similar to the order workflow sample

we get this error

"Event \"RequestApproved\" on interface type \"RequestLocalServices.IRequestService\" for instance id \"8ce3ae0f-a8f5-4c15-826d-59dfbadf2515\" cannot be delivered."

Can any one plz help

[346 byte] By [shivali.sadavarte] at [2007-12-22]
# 1
Which build are you using? Where are you hosting the workflow? Are you using a state machine or sequential workflow? With a state machine if you are not in the correct state yet this can happen. If it is just a timing issue with your state transition you can try setting WaitForIdle to true on your ExternalDataEventArgs before raising the event. This will let the workflow complete its processing before the event is processed.
TomLake at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2

Thanks Tom for such a quick reply

We have been using Beta2.

hosting the state machine workflow with a web application

Could you please give the location and line of code to be put in the code?

Pasting my code here

using System;

using System.Collections.Generic;

using System.Text;

namespace RequestLocalServices

{

[Serializable]

public class RequestService : IRequestService

{

public RequestService()

{

}

public void RaiseRequestCreatedEvent(string RequestId, Guid instanceId)

{

if (RequestCreated != null)

RequestCreated(null, new RequestEventArgs(instanceId, RequestId));

}

public void RaiseRequestApprovedEvent(string RequestId, Guid instanceId)

{

if (RequestApproved != null)

RequestApproved(null, new RequestEventArgs(instanceId, RequestId));

}

public void RaiseRequestRejectedEvent(string RequestId, Guid instanceId)

{

if (RequestRejected != null)

RequestRejected(null, new RequestEventArgs(instanceId, RequestId));

}

public void RaiseRequestProcessedEvent(string RequestId, Guid instanceId)

{

if (RequestProcessed != null)

RequestProcessed(null, new RequestEventArgs(instanceId, RequestId));

}

public event EventHandler<RequestEventArgs> RequestCreated;

public event EventHandler<RequestEventArgs> RequestApproved;

public event EventHandler<RequestEventArgs> RequestRejected;

public event EventHandler<RequestEventArgs> RequestProcessed;

}

}

--

using System;

using System.Collections.Generic;

using System.Text;

using System.Workflow.ComponentModel;

using System.Workflow.Activities;

namespace RequestLocalServices

{

[Serializable]

public class RequestEventArgs : ExternalDataEventArgs

{

private string _RequestId;

public RequestEventArgs(Guid instanceId, string RequestId)

: base(instanceId)

{

_RequestId = RequestId;

}

public string RequestId

{

get { return _RequestId; }

set { _RequestId = value; }

}

}

[ExternalDataExchange]

public interface IRequestService

{

event EventHandler<RequestEventArgs> RequestCreated;

event EventHandler<RequestEventArgs> RequestApproved;

event EventHandler<RequestEventArgs> RequestRejected;

event EventHandler<RequestEventArgs> RequestProcessed;

}

}

Thanks,

Shivali

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

Thanks Tom for such a quick reply

We have been using Beta2.

hosting the state machine workflow with a web application

Could you please give the location and line of code to be put in the code?

Pasting my code here

using System;

using System.Collections.Generic;

using System.Text;

namespace RequestLocalServices

{

[Serializable]

public class RequestService : IRequestService

{

public RequestService()

{

}

public void RaiseRequestCreatedEvent(string RequestId, Guid instanceId)

{

if (RequestCreated != null)

RequestCreated(null, new RequestEventArgs(instanceId, RequestId));

}

public void RaiseRequestApprovedEvent(string RequestId, Guid instanceId)

{

if (RequestApproved != null)

RequestApproved(null, new RequestEventArgs(instanceId, RequestId));

}

public void RaiseRequestRejectedEvent(string RequestId, Guid instanceId)

{

if (RequestRejected != null)

RequestRejected(null, new RequestEventArgs(instanceId, RequestId));

}

public void RaiseRequestProcessedEvent(string RequestId, Guid instanceId)

{

if (RequestProcessed != null)

RequestProcessed(null, new RequestEventArgs(instanceId, RequestId));

}

public event EventHandler<RequestEventArgs> RequestCreated;

public event EventHandler<RequestEventArgs> RequestApproved;

public event EventHandler<RequestEventArgs> RequestRejected;

public event EventHandler<RequestEventArgs> RequestProcessed;

}

}

--

using System;

using System.Collections.Generic;

using System.Text;

using System.Workflow.ComponentModel;

using System.Workflow.Activities;

namespace RequestLocalServices

{

[Serializable]

public class RequestEventArgs : ExternalDataEventArgs

{

private string _RequestId;

public RequestEventArgs(Guid instanceId, string RequestId)

: base(instanceId)

{

_RequestId = RequestId;

}

public string RequestId

{

get { return _RequestId; }

set { _RequestId = value; }

}

}

[ExternalDataExchange]

public interface IRequestService

{

event EventHandler<RequestEventArgs> RequestCreated;

event EventHandler<RequestEventArgs> RequestApproved;

event EventHandler<RequestEventArgs> RequestRejected;

event EventHandler<RequestEventArgs> RequestProcessed;

}

}

Thanks,

Shivali

shivali.sadavarte at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
Plz help
shivali.sadavarte at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 5
Take a look at the sample I have on my blog.
TomLake at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 6
In my experience there are several things that can cause the event delivery to fail, and the exception that gets thrown doesn't help much with figuring out what your problem is.

In one case I had omitted to create an instance of the object that implements the interface containing the event definitions. In your case, this would be RequestService. Make sure your application that is going to raise the event is creating that object and adding as a service. Something like:

// Get a new workflow runtime
WorkflowRuntime wr = new WorkflowRuntime();

// Add the external data service
ExternalDataExchangeService dataService = new ExternalDataExchangeService();
wr.AddService(dataService);

// Add custom manual charge service
requestService = new RequestService();
dataService.AddService(requestService);

// Start
wr.StartRuntime();

wirwin at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 7
Another error I had made was to pass an incorrect parameter when raising the event. I was doing (translating to your example)

RequestCreated(this, new RequestEventArgs(instanceId, RequestId));

instead of :

RequestCreated(null, new RequestEventArgs(instanceId, RequestId));

Bad code on my part; but I wish the exception could be a bit more explicit about what is wrong.

wirwin at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 8
I still get the same error
shivali.sadavarte at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 9
Are you still using Beta 2? Can you send me the project or a simple repro? My email address is on my profile.
TomLake at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 10

I have downloaded and installed Visual Studio 2005 Extensions for Windows Workflow Foundation RC2(EN). When i try to install the WWF debugger, i get this window -

Platform Prerequisites Missing
Based on the components you selected to install, you must first install the following prerequisites.

  • - - Windows Workflow Foundation version 3.0.4125.0

    Some required prerequisites are unavailable. You will not be able to automatically download updates.

  • Please guide

    Thanks

    shivali.sadavarte at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
    # 11
    Please use WF as an abbreviation for Windows Workflow Foundation instead of WWF. Prior to RC2 the runtime component were installed with the VS extensions if they were not already installed. Now you must install the .NET Framework 3.0 Runtime, from here, to get the WF runtime components. Upgrading won't resolve the EventDeliveryFailureException you are getting.
    TomLake at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
    # 12
    After looking at your code the reason you are getting the event delivery failure is because your state machine is not in the correct state to receive the event you are firing. You will need to raise the event to transition to the correct state first.
    TomLake at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
    # 13

    I am having exactly the same "windows workflow foundation version 3.0.4125.0 required" message

    I have a clean installation of vista 64 bit, and the SDK.

    The instructions state the the WF component is part of Vista, so... where is it I ask myself?

    JK

    JohnKinghorn at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
    # 14
    Take a look at this post for information on enabling WF on Vista.
    TomLake at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

    Software Development for Windows Vista

    Site Classified