InnerException {"Event \"HighRiskEvent\" on interface type \"MainWorkflow.ICommunicationService\" for instance id \"feae4f11-

Hi,

I am getting following error:

- Exception {"Exception has been thrown by the target of an invocation."} System.Exception {System.Reflection.TargetInvocationException}

- InnerException {"Event \"HighRiskEvent\" on interface type \"MainWorkflow.ICommunicationService\" for instance id \"feae4f11-87e5-43a1-8807-cfd98d9ca81d\" cannot be delivered."} System.Exception {System.Workflow.Activities.EventDeliveryFailedException}

- InnerException {"Event Queue operation failed with MessageQueueErrorCode QueueNotFound for queue 'Message Properties\r\nInterface Type:MainWorkflow.ICommunicationService\r\nMethod Name:HighRiskEvent\r\nCorrelationValues:\r\n'."} System.Exception {System.InvalidOperationException}

My code:

[ExternalDataExchange]

internal interface ICommunicationService

{

void NoRisk();

event EventHandler<ExternalDataEventArgs> NoRiskEvent;

void SmallRisk();

event EventHandler<ExternalDataEventArgs> SmallRiskEvent;

void HighRisk();

event EventHandler<ExternalDataEventArgs> HighRiskEvent;

}

internal class CommunicationService : ICommunicationService

{

public void NoRisk()

{

if (NoRiskEvent != null)

{

NoRiskEvent(null, new ExternalDataEventArgs(WorkflowEnvironment.WorkflowInstanceId));

}

}

public event EventHandler<ExternalDataEventArgs> NoRiskEvent;

public void SmallRisk()

{

if (SmallRiskEvent != null)

{

SmallRiskEvent(null, new ExternalDataEventArgs(WorkflowEnvironment.WorkflowInstanceId));

}

}

public event EventHandler<ExternalDataEventArgs> SmallRiskEvent;

public void HighRisk()

{

if (HighRiskEvent != null)

{

HighRiskEvent(null, new ExternalDataEventArgs(WorkflowEnvironment.WorkflowInstanceId));

}

}

public event EventHandler<ExternalDataEventArgs> HighRiskEvent;

}

AND:

WorkflowRuntime workflowRuntime = new WorkflowRuntime();

ExternalDataExchangeService externalService = new ExternalDataExchangeService();

workflowRuntime.AddService(externalService);

CommunicationService comSrv = new CommunicationService();

externalService.AddService(comSrv);

workflowRuntime.StartRuntime();

and inside one of the workflow I am calling CallExternalMethodActivity: HighRisk. When I debug line

HighRiskEvent(null, new ExternalDataEventArgs(WorkflowEnvironment.WorkflowInstanceId));

I get already mentioned exception.

Any help Thank you in advance.

Peter



Answer this question

InnerException {"Event \"HighRiskEvent\" on interface type \"MainWorkflow.ICommunicationService\" for instance id \"feae4f11-

  • Milind Saraswala

    I should be probably more specific: I have 2 workflows running in the same WorkflowRuntime and one (seq.WF) is using CallExternalMethod and second one (state mach. WF) is listening.

    Thank you for any help.

    peter


  • Harrison N.

    Menawhile I found out what was the problem:

    HighRiskEvent(null, new ExternalDataEventArgs(WorkflowEnvironment.WorkflowInstanceId));

    instead shoud be

    HighRiskEvent(null, ...Guid of workflow expecting this...));


  • rickdom

    Did you mean to say the Guid of the workflow instance

    If not, how then do you ascertain the Guid of the workflow itself


  • InnerException {"Event \"HighRiskEvent\" on interface type \"MainWorkflow.ICommunicationService\" for instance id \"feae4f11-