Freigeben über


Agent went async but did not call Resume (Event Id 1057)

In Exchange 2013 you may see the following in the event log if you don't call resume in your asynchronous agent

Log Name:      Application
Source:        MSExchange Extensibility
Event ID:      1057
Task Category: MExRuntime
Level:         Error
Keywords:      Classic
User:          N/A
Description:
Agent 'Smith' went async but did not call Resume on the new thread, while handling event 'OnSubmittedMessage'

It is a best practice to call AsyncAgentContext.Resume() in your worker thread before doing any work to complete the event.  This ensures that the thread is properly initialized for asynchronous event handling.

Comments

  • Anonymous
    November 24, 2016
    It's not very clear as to where the .Resume() should be called within the event handler."Before doing any work to complete the event" can be interpreted in several ways, and many exchange agents out there get it wrong and can't resolve this event log problem.The only way I could get this to go away was to call .Resume() immediately before .Complete() this.agentAsyncContext.Resume(); this.agentAsyncContext.Complete();If you put it anywhere else in the thread, the error still happens. // Call resume RIGHT BEFORE you call complete // This is the most badly documented option to get rid of the // "Agent '' went async but did not call Resume on the new thread error this.agentAsyncContext.Resume(); // This allows Exchange to continue processing the message this.agentAsyncContext.Complete();