Reputation: 39148
I'm talking to a customer who has re-registered one of their plugin to asynchronous position and they claim that their experience "weird behavior". According to the description, it seems that when an exception is thrown in the async plugin (message create), the process is not rolled back. The instance is created.
Is that an intended behavior? And if so, what can be done to stop it?
Upvotes: 0
Views: 2037
Reputation: 15128
Asynchronous plugins are not executed inside the main operation transaction, this means that when an exception is thrown the main operation is not rolled back.
The common example is the creation of a task inside a plugin when a new account is created:
If the plugin is synchronous and an InvalidPluginExecutionException
is thrown in your plugin, both account and task will not be created and the error is prompted to the user.
If the plugin is asynchronous and an InvalidPluginExecutionException
is thrown in your plugin, the account will be created, the task will not be created and no error is prompted to the user.
MSDN - Event Execution Pipeline
Upvotes: 4