C#C
C#2y ago
35 replies
Mozzarella

RunSynchronously may not be called on a task not bound to a delegate

I have a sync kafka method that interfaces message on kafka, whenever I use it on method I got error called 'RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method.'

is there anyway to use and make a sure sendKafka Method completes when it is called without changing the implementation of SendKafka method itself?:

public void InterfaceUserInformation(IDbContext dbContext, Materiallot materiallot, MessageData messageData)
{
    MessageBuilderMD messageBuilderMD = new MessageBuilderMD();
    messageBuilderMD
        .WithMessageData(messageData)
        .WithNameOfRequest("To try")
        .Build();
    kafkaContext.SendKafka(messageBuilderMD.GetMessageData(), dbContext);
   
}
Was this page helpful?