I've found a bug in CRM 2011 (replicated Online, so using the latest rollup).
When replying to an email attached to a Case (incident), the system may create an extra copy of the created reply.
This happens when a plugin is registered which performs any code when creating a new email.
Steps to replicate:
a) create a new CRM 2011 plugin; the plugin code:
public class Create : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(9));
}
}
The bug is fiddly; sometimes it will replicate perfectly, other times it will appear only once. Thus the plugin adds some delay to simulate some operations being performed.
b) register the plugin in CRM Online; register a new create step for theemail entity. Should not matter if it is a pre-validation, a pre-operation or a post-operation step.
c) create a new case
d) add a new email to the case activities
e) send the email or change it's state to "sent" (I use a simple on-demand workflow which changes the state)
f) reply to the email
Once the new email window is opened with the reply, note how many unclosed activities there are in the crated case. You should see 2 activities - 2 identical emails (assuming you've made no changes to the generated reply mail).
With the added delay in the plugin I was able to replicate the problem almost every time. When the problem stopped happening all I had to do was unregisted the entire plugin (then the problem should happen once), and then register the plugin once more (the problem should happen at least once).
I did not test if this happens outside of cases; however, it is mostly annoying when used with conjunction with cases, as the created copy of the email prevents the case from being closed.
The only workaround I found so far was to use asynchronous steps, but even then the problem might occur; seems to happen when the async service is started and needs to load the plugin DLL for the first time.
At this point I'm interested in two things:
1) Is there a workaround that will ALWAYS work?
2) Is this the correct way to report a MS CRM 2011 bug - as in, via the forums?