locked
CRM - strange behavior!! RRS feed

  • Question

  • I have a plugin - which I know works because it used to work in my local testing deployment and still works in CRM Online. Something has gone wrong with my local deployment. Everytime my plugin tries to create a new entity I get the message below (which is produced by the plugin when an error occurs). The even weirder part is that I will get this message more than once per operation. And never the same amount. My plugin operates on an email. If an error occurs it changes the content of the email to display the error message created by the plugin (like the one below). But I am sometimes getting multiple emails sometimes. Sometimes 1. Sometimes 2. Sometimes even 3 or 4. It is behaving like multiple operations have occurred but in fact only one has, and the client only knows of one operation occurring. This is nuts!

    <tt>

    An error occured.

    Message: An unexpected error occurred.

    Stack:

     

    Server stack trace:

    at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

    at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

    at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

    at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

     

    Exception rethrown at [0]:

    at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)

    at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)

    at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

     

    Exception rethrown at [1]:

    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

    at Microsoft.Crm.Sandbox.ISandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)

    at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request)

    at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.CreateInternal(Entity entity)

    at EmailPlugin.Execute(IServiceProvider serviceProvider)

    </tt>

    Friday, July 8, 2011 12:58 AM

Answers

  • is the plugin registed in Update message and trying to update the same enitity it is registered on? if so this is problem of infinite loop.
    • Marked as answer by passenger19 Thursday, July 21, 2011 10:24 PM
    Thursday, July 21, 2011 10:19 PM

All replies

  • is the plugin registed in Update message and trying to update the same enitity it is registered on? if so this is problem of infinite loop.
    • Marked as answer by passenger19 Thursday, July 21, 2011 10:24 PM
    Thursday, July 21, 2011 10:19 PM
  • I probably should have deleted this thread.

    Unfortunately I can't remember what solved the issue or what was creating it. I have re-written the plugin since posting this.

    Just to put an end to the thread I will mark your response as the answer - as it is probably a good guess.

    Thursday, July 21, 2011 10:24 PM
  • You can check the context.Depth. if it’s 1 then run your plug-in otherwise do nothing
    Regards Faisal
    Thursday, July 21, 2011 10:28 PM