locked
Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. RRS feed

  • Question

  • This is the event log...........................................

    The Web Service plug-in failed in OrganizationId: e12b6b3e-0003-df11-be23-005056866e38; SdkMessageProcessingStepId: 8ecbbb1b-ea3e-db11-86a7-000a3a5473e8; EntityName: businessunit; Stage: 30; MessageName: Retrieve; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
       at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
       at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
       at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    Inner Exception: System.InvalidOperationException: There is already an open DataReader associated with this Command which must be closed first.
       at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
       at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
       at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
       at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
       at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
       at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command)
       at Microsoft.Crm.CrmDbConnection.InternalExecuteReader(IDbCommand command, Boolean capturePerfTrace)
       at Microsoft.Crm.CrmDbConnection.ExecuteReader(IDbCommand command, Boolean impersonate, Boolean capturePerfTrace)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.ExecuteQuery(CrmDbConnection dbConnection, IDbCommand command, ISqlExecutionContext context, Nullable`1 commandTimeout)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.DoRetrieve(BusinessEntityMoniker moniker, BusinessEntity entity, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode, DatabaseQueryTarget queryTarget)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode, DatabaseQueryTarget queryTarget)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context, Int32 languageCode)
       at Microsoft.Crm.BusinessEntities.BusinessProcessObject.Retrieve(BusinessEntityMoniker moniker, EntityExpression entityExpression, ExecutionContext context)
    .================================================================================

    Can anyboday please help me how can i find out which plugin is throwing this error?

    thanks


    Red

    Thursday, April 18, 2013 5:12 PM

Answers

  • I found the resolution for this:

    One of the CRM blogs has this suggestion:

    "CRM does not re-initialize the plug-in object again, it uses the same object. In the plug-in, ignore to use class level variables."

    That was exactly wrong with it. After removing the class level variable. This issue is resolved.

    Thanks



    Red

    • Marked as answer by ColorRED Friday, May 10, 2013 11:05 PM
    Friday, May 10, 2013 11:05 PM

All replies

  • Hey Red,

    1. Did you get this event log from CRM server?

    2. Which version of CRM server + Outlook client(if any) is installed?

    3. Can you detail out the steps which leads to this issue? 

    4. Are you CRM Online or CRM OnPrem user?

    Please reply to these questions.

    Thanks 

    Harshit

    Monday, May 6, 2013 10:43 PM
  • Hi,

    The error you are getting because your plugin is trying to retrieve a record which is already being used by any other plugin and that other plugin have locked it. To avoid such condition kindly use "QueryExpression.NoLock= true" wherever you are using query expression in code.

    Hope this helps!

    Tuesday, May 7, 2013 8:20 AM
  • Hello Harshit,

    1. Did you get this event log from CRM server?

    YES

    2. Which version of CRM server + Outlook client(if any) is installed?

    2011 + outlook 2010

    3. Can you detail out the steps which leads to this issue? 

    when i am opening a account, just opening. (Intermittent)

    4. Are you CRM Online or CRM OnPrem user?

    Onperm user.

    Thank you so much for repling. I am trying to resolve this error forever.

    Red

    Tuesday, May 7, 2013 11:18 PM
  • Hello Gavrav, It didnt help :(

    Thanks


    Red


    • Edited by ColorRED Wednesday, May 8, 2013 12:07 AM
    Tuesday, May 7, 2013 11:19 PM
  • I found the resolution for this:

    One of the CRM blogs has this suggestion:

    "CRM does not re-initialize the plug-in object again, it uses the same object. In the plug-in, ignore to use class level variables."

    That was exactly wrong with it. After removing the class level variable. This issue is resolved.

    Thanks



    Red

    • Marked as answer by ColorRED Friday, May 10, 2013 11:05 PM
    Friday, May 10, 2013 11:05 PM
  • What if it is in case of crm 4.0. where no lock kind of thing cannot be found

    Friday, July 26, 2013 11:58 AM