locked
CRM 2013 plugin InvalidPluginExecutionException doesn't display message RRS feed

  • Question

  • when i through some exception in plugin to display message on the screen using InvalidPluginExecutionException method,

    CRM just display generic message. but when i check the trace directory, i see that message with some exception.

    I guess whtever custom message we want that method  allow us to display message on the screen. isn't it??

    Does any one has similar issue like that?? 


    Friday, July 18, 2014 4:51 PM

Answers

  • Any one have any clue what i could be doing wrong here??

    this is the syntax i use for throwing error:-

     throw new InvalidPluginExecutionException("Please Try Again for XYZ reason.");

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Wednesday, July 23, 2014 3:02 PM
  • This is a correct statement to throw exception.

    Our Website| Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.


    Wednesday, July 23, 2014 5:28 PM
    Moderator
  • It doesn't matter whether we use that statement in catch block or in try block?? 

    We migrated from CRM 4.0 to 2013 server, does that make any difference??

    when i look at Trace log file on server afterr enabling the trace..i see below error:-

    # CRM Tracing Version 2.0
    # LocalTime: 2014-07-16 13:07:22.290
    # Categories: 
    # CallStackOn: No
    # ComputerName: CRMTESTSERVER
    # CRMVersion: 6.1.0000.0581
    # DeploymentType: OnPremise
    # ScaleGroup: 
    # ServerRole: AppServer, AsyncService, DiscoveryService, ApiServer, HelpServer, DeploymentService, SandboxServer, DeploymentManagementTools, VssWriter, EmailConnector
    
    [2014-07-16 13:07:22.290] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   18 |Category: Platform.Metadata |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: cfafbeeb-0f09-4ba4-a1bb-bb07110d7e15 | <>c__DisplayClass1.<LoadMetadataContainerFromDatabase>b__0  ilOffset = 0x14
    >Multi-org sharable cache loading system and non-system metadata with build number 6.1.0.581 and language 1033
    [2014-07-16 13:08:13.272] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   14 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: bbcd92a2-fb42-445f-9251-cc390fe93f32 | Visualization.Render  ilOffset = 0x138
    >Rendering of visualization failed with exception: System.ArgumentNullException: Value cannot be null.
    Parameter name: g
       at System.Guid..ctor(String g)
       at Microsoft.Crm.Web.Charts.Visualization.Render(HtmlTextWriter output)
    [2014-07-16 13:08:27.889] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Platform.Sdk |User: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | VersionedPluginProxyStepBase.Execute  ilOffset = 0x65
    >Web Service Plug-in failed in SdkMessageProcessingStepId: {3F259459-F70C-E411-940C-0050568B5161}; EntityName: account; Stage: 20; MessageName: Merge; AssemblyName: ORGPlugin.Plugins.PreCustomerMerge, ORGPlugin.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f42582ef03e49ebf; ClassName: ORGPlugin.Plugins.PreCustomerMerge; Exception: Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: An error occurred in the ExecutePreCustomerMerge Plug-in.
       at ORGPlugin.Plugins.PreCustomerMerge.ExecutePreCustomerMerge(LocalPluginContext localContext)
       at ORGPlugin.Plugins.Plugin.Execute(IServiceProvider serviceProvider)
       at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
       at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    Inner Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: Hello, This is from a plugin that Nick has created for Merge :)  Please Try Again for XYZ Reason 760571700
       at ORGPlugin.Plugins.PreCustomerMerge.ExecutePreCustomerMerge(LocalPluginContext localContext)
    .
    [2014-07-16 13:08:27.889] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Platform |User: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | MessageProcessor.Execute  ilOffset = 0x18F
    >MessageProcessor fail to process message 'Merge' for 'account'.
    [2014-07-16 13:08:27.905] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ExceptionConverter.ConvertToFault  ilOffset = 0x57
    >UNEXPECTED: no fault?
    [2014-07-16 13:08:27.920] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ExceptionConverter.ConvertToFault  ilOffset = 0x69
    >UNEXPECTED: no fault?
    [2014-07-16 13:08:27.920] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ExceptionConverter.ConvertToFault  ilOffset = 0x69
    >UNEXPECTED: no fault?
    [2014-07-16 13:08:27.936] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | CrmException..ctor  ilOffset = 0x7
    	at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)  ilOffset = 0x7
    	at CrmException..ctor(String message, Int32 errorCode)  ilOffset = 0x5
    	at PlatformCommand.CreateCrmExceptionFromServiceFault(FaultException`1 fe)  ilOffset = 0x1B
    	at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    	at MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)  ilOffset = 0x9D
    	at MergeRecordsHandler.ProcessRequestInternal(HttpRequest request)  ilOffset = 0x158
    	at AppHttpHandlerWithKeepAlive.ProcessRequestInternal(HttpContext context)  ilOffset = 0x49
    	at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    	at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    	at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    	at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    	at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    	at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B
    >Crm Exception: Message: An error occurred in the ExecutePreCustomerMerge Plug-in., ErrorCode: -2147220891
    [2014-07-16 13:08:27.951] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ErrorInformation.LogError  ilOffset = 0x17
    >MSCRM Error Report:
    --------------------------------------------------------------------------------------------------------
    Error: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Number: 0x80040265
    
    Error Message: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Details: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Source File: Not available
    
    Line Number: Not available
    
    Request URL: 
    
    Stack Trace Info: [CrmException: An error occurred in the ExecutePreCustomerMerge Plug-in.]
       at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)
    
    
    [2014-07-16 13:08:27.967] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | Util.TraceMessage  ilOffset = 0x79
    >UserId ({D36197EF-A24D-E311-B3B0-0050568B3B5C}): Error in MergeRecordsHandler: Microsoft.Crm.CrmException: An error occurred in the ExecutePreCustomerMerge Plug-in.
       at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.ProcessRequestInternal(HttpRequest request)
       at Microsoft.Crm.Application.AppHttpHandlerWithKeepAlive.ProcessRequestInternal(HttpContext context)
    [2014-07-16 13:08:27.967] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ErrorInformation.LogError  ilOffset = 0x17
    >MSCRM Error Report:
    --------------------------------------------------------------------------------------------------------
    Error: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Number: 0x80040265
    
    Error Message: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Details: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Source File: Not available
    
    Line Number: Not available
    
    Request URL: http://CRMTESTServer/CRMTESTServer/AppWebServices/MergeRecords.ashx?dataXml=&masterId=%7b36E3AB94-1EDE-E211-9E9E-0050568B3B5C%7d&objectTypeCode=1&operation=Merge&parentingCheck=1&subordinateId=%7b4D4BCD1C-2B9B-4458-8A50-FA4FCDCFC40F%7d&update=false
    
    Stack Trace Info: [CrmException: An error occurred in the ExecutePreCustomerMerge Plug-in.]
       at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.ProcessRequestInternal(HttpRequest request)
       at Microsoft.Crm.Application.AppHttpHandlerWithKeepAlive.ProcessRequestInternal(HttpContext context)
    
    
    [2014-07-16 13:08:38.311] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:    8(MSCRM:-NotificationManager.NotificationWatcherThreadProc) |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId:  | ExecutionContext.RunInternal  ilOffset = 0x70
    >NotificationWatcherThreadProc Stopped. 
    [2014-07-16 13:08:38.311] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:    9(MSCRM:-MetadataCache.RemoveUnusedCachesThreadProc) |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId:  | ExecutionContext.RunInternal  ilOffset = 0x70
    >RemoveUnusedCachesThreadProc Stopped.
    

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:38 PM
    Wednesday, July 23, 2014 5:56 PM
  • If you want to manually throw exception, it does not matter you can use it any where, but this error is because of your plugin

    There is error in your plugin "Value cannot be null it seems you are getting this error before the statement itself that you have used to throw exception. Try to debug your plugin

    [2014-07-16 13:07:22.290] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   18 |Category: Platform.Metadata |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: cfafbeeb-0f09-4ba4-a1bb-bb07110d7e15 | <>c__DisplayClass1.<LoadMetadataContainerFromDatabase>b__0  ilOffset = 0x14
    >Multi-org sharable cache loading system and non-system metadata with build number 6.1.0.581 and language 1033
    [2014-07-16 13:08:13.272] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   14 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: bbcd92a2-fb42-445f-9251-cc390fe93f32 | Visualization.Render  ilOffset = 0x138
    >Rendering of visualization failed with exception: System.ArgumentNullException: Value cannot be null.
    Parameter name: g
    

     


    Our Website| Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.


    Thursday, July 24, 2014 2:09 AM
    Moderator
  • Format for  InvalidPluginExecutionException goes as follows:

    InvalidPluginExecutionException (Microsoft.Xrm.Sdk.OperationStatus status, int errorcode, string message)

    I would try adding a status and error code.

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 2:40 PM
  • I have tried all different syntax's with and without all parameters, but didn't had a luck.

    That above "Value can not be null" was related to some other issue. that doesn't appear any more. things are getting frustrated here.

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:19 PM
  • Seems like the Business Process Error is encountered in your plugin at some point before you are attempting to raise the InvalidPluginExecutionException, therefore it is reporting something generic.  Have you stepped through the code to be sure?

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:30 PM
  • yes I did step through so many times. It goes to that exception  InvalidPluginExecutionException just fine and after that syntax it goes to catch block and throw the message.

    Nothing special about this and I don't understand after that syntax is that system level error or what??

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:35 PM
  • Did I read correctly that you are catching the exception and re-throwing?  Reading your trace it seems like your error is reported as the INNER exception.  CRM will only report on the OUTER exception in the UI. 
    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:48 PM
  • What do you mean. I try throwing only one time as well, but no luck. can you please provide sample code for at least one function with that syntax that work for you??
    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:59 PM
  • Ok.  Generic Example:

    try
    {
    //--  Execute Code Here  --
    }
    catch (Exception ex)
    {
    //--  Throw new Execution Error  --
    throw new InvalidPluginExecutionException(Microsoft.Xrm.Sdk.OperationStatus.Failed, -2147220956, "Execution Failed Error");
    }

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 8:08 PM

All replies

  • Any one have any clue what i could be doing wrong here??

    this is the syntax i use for throwing error:-

     throw new InvalidPluginExecutionException("Please Try Again for XYZ reason.");

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Wednesday, July 23, 2014 3:02 PM
  • This is a correct statement to throw exception.

    Our Website| Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.


    Wednesday, July 23, 2014 5:28 PM
    Moderator
  • It doesn't matter whether we use that statement in catch block or in try block?? 

    We migrated from CRM 4.0 to 2013 server, does that make any difference??

    when i look at Trace log file on server afterr enabling the trace..i see below error:-

    # CRM Tracing Version 2.0
    # LocalTime: 2014-07-16 13:07:22.290
    # Categories: 
    # CallStackOn: No
    # ComputerName: CRMTESTSERVER
    # CRMVersion: 6.1.0000.0581
    # DeploymentType: OnPremise
    # ScaleGroup: 
    # ServerRole: AppServer, AsyncService, DiscoveryService, ApiServer, HelpServer, DeploymentService, SandboxServer, DeploymentManagementTools, VssWriter, EmailConnector
    
    [2014-07-16 13:07:22.290] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   18 |Category: Platform.Metadata |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: cfafbeeb-0f09-4ba4-a1bb-bb07110d7e15 | <>c__DisplayClass1.<LoadMetadataContainerFromDatabase>b__0  ilOffset = 0x14
    >Multi-org sharable cache loading system and non-system metadata with build number 6.1.0.581 and language 1033
    [2014-07-16 13:08:13.272] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   14 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: bbcd92a2-fb42-445f-9251-cc390fe93f32 | Visualization.Render  ilOffset = 0x138
    >Rendering of visualization failed with exception: System.ArgumentNullException: Value cannot be null.
    Parameter name: g
       at System.Guid..ctor(String g)
       at Microsoft.Crm.Web.Charts.Visualization.Render(HtmlTextWriter output)
    [2014-07-16 13:08:27.889] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Platform.Sdk |User: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | VersionedPluginProxyStepBase.Execute  ilOffset = 0x65
    >Web Service Plug-in failed in SdkMessageProcessingStepId: {3F259459-F70C-E411-940C-0050568B5161}; EntityName: account; Stage: 20; MessageName: Merge; AssemblyName: ORGPlugin.Plugins.PreCustomerMerge, ORGPlugin.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f42582ef03e49ebf; ClassName: ORGPlugin.Plugins.PreCustomerMerge; Exception: Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: An error occurred in the ExecutePreCustomerMerge Plug-in.
       at ORGPlugin.Plugins.PreCustomerMerge.ExecutePreCustomerMerge(LocalPluginContext localContext)
       at ORGPlugin.Plugins.Plugin.Execute(IServiceProvider serviceProvider)
       at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
       at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    Inner Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: Hello, This is from a plugin that Nick has created for Merge :)  Please Try Again for XYZ Reason 760571700
       at ORGPlugin.Plugins.PreCustomerMerge.ExecutePreCustomerMerge(LocalPluginContext localContext)
    .
    [2014-07-16 13:08:27.889] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Platform |User: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | MessageProcessor.Execute  ilOffset = 0x18F
    >MessageProcessor fail to process message 'Merge' for 'account'.
    [2014-07-16 13:08:27.905] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ExceptionConverter.ConvertToFault  ilOffset = 0x57
    >UNEXPECTED: no fault?
    [2014-07-16 13:08:27.920] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ExceptionConverter.ConvertToFault  ilOffset = 0x69
    >UNEXPECTED: no fault?
    [2014-07-16 13:08:27.920] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ExceptionConverter.ConvertToFault  ilOffset = 0x69
    >UNEXPECTED: no fault?
    [2014-07-16 13:08:27.936] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:   23 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | CrmException..ctor  ilOffset = 0x7
    	at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)  ilOffset = 0x7
    	at CrmException..ctor(String message, Int32 errorCode)  ilOffset = 0x5
    	at PlatformCommand.CreateCrmExceptionFromServiceFault(FaultException`1 fe)  ilOffset = 0x1B
    	at PlatformCommand.XrmExecuteInternal()  ilOffset = 0xF6
    	at MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)  ilOffset = 0x9D
    	at MergeRecordsHandler.ProcessRequestInternal(HttpRequest request)  ilOffset = 0x158
    	at AppHttpHandlerWithKeepAlive.ProcessRequestInternal(HttpContext context)  ilOffset = 0x49
    	at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()  ilOffset = 0x18D
    	at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  ilOffset = 0x15
    	at ApplicationStepManager.ResumeSteps(Exception error)  ilOffset = 0x10A
    	at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)  ilOffset = 0x5C
    	at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)  ilOffset = 0x16A
    	at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)  ilOffset = 0x4B
    >Crm Exception: Message: An error occurred in the ExecutePreCustomerMerge Plug-in., ErrorCode: -2147220891
    [2014-07-16 13:08:27.951] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ErrorInformation.LogError  ilOffset = 0x17
    >MSCRM Error Report:
    --------------------------------------------------------------------------------------------------------
    Error: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Number: 0x80040265
    
    Error Message: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Details: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Source File: Not available
    
    Line Number: Not available
    
    Request URL: 
    
    Stack Trace Info: [CrmException: An error occurred in the ExecutePreCustomerMerge Plug-in.]
       at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)
    
    
    [2014-07-16 13:08:27.967] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | Util.TraceMessage  ilOffset = 0x79
    >UserId ({D36197EF-A24D-E311-B3B0-0050568B3B5C}): Error in MergeRecordsHandler: Microsoft.Crm.CrmException: An error occurred in the ExecutePreCustomerMerge Plug-in.
       at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.ProcessRequestInternal(HttpRequest request)
       at Microsoft.Crm.Application.AppHttpHandlerWithKeepAlive.ProcessRequestInternal(HttpContext context)
    [2014-07-16 13:08:27.967] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   23 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 977b25c9-893e-4551-9c89-a23e79629ee4 | ErrorInformation.LogError  ilOffset = 0x17
    >MSCRM Error Report:
    --------------------------------------------------------------------------------------------------------
    Error: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Number: 0x80040265
    
    Error Message: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Error Details: An error occurred in the ExecutePreCustomerMerge Plug-in.
    
    Source File: Not available
    
    Line Number: Not available
    
    Request URL: http://CRMTESTServer/CRMTESTServer/AppWebServices/MergeRecords.ashx?dataXml=&masterId=%7b36E3AB94-1EDE-E211-9E9E-0050568B3B5C%7d&objectTypeCode=1&operation=Merge&parentingCheck=1&subordinateId=%7b4D4BCD1C-2B9B-4458-8A50-FA4FCDCFC40F%7d&update=false
    
    Stack Trace Info: [CrmException: An error occurred in the ExecutePreCustomerMerge Plug-in.]
       at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.XrmExecuteInternal()
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.Merge(String dataXml, Guid masterId, Guid subordinateId, Boolean update, Int32 parentingCheck, Int32 objectTypeCode)
       at Microsoft.Crm.Core.Application.WebServices.MergeRecordsHandler.ProcessRequestInternal(HttpRequest request)
       at Microsoft.Crm.Application.AppHttpHandlerWithKeepAlive.ProcessRequestInternal(HttpContext context)
    
    
    [2014-07-16 13:08:38.311] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:    8(MSCRM:-NotificationManager.NotificationWatcherThreadProc) |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId:  | ExecutionContext.RunInternal  ilOffset = 0x70
    >NotificationWatcherThreadProc Stopped. 
    [2014-07-16 13:08:38.311] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread:    9(MSCRM:-MetadataCache.RemoveUnusedCachesThreadProc) |Category: Platform |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId:  | ExecutionContext.RunInternal  ilOffset = 0x70
    >RemoveUnusedCachesThreadProc Stopped.
    

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:38 PM
    Wednesday, July 23, 2014 5:56 PM
  • If you want to manually throw exception, it does not matter you can use it any where, but this error is because of your plugin

    There is error in your plugin "Value cannot be null it seems you are getting this error before the statement itself that you have used to throw exception. Try to debug your plugin

    [2014-07-16 13:07:22.290] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   18 |Category: Platform.Metadata |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: cfafbeeb-0f09-4ba4-a1bb-bb07110d7e15 | <>c__DisplayClass1.<LoadMetadataContainerFromDatabase>b__0  ilOffset = 0x14
    >Multi-org sharable cache loading system and non-system metadata with build number 6.1.0.581 and language 1033
    [2014-07-16 13:08:13.272] Process: w3wp |Organization:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx |Thread:   14 |Category: Application |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: bbcd92a2-fb42-445f-9251-cc390fe93f32 | Visualization.Render  ilOffset = 0x138
    >Rendering of visualization failed with exception: System.ArgumentNullException: Value cannot be null.
    Parameter name: g
    

     


    Our Website| Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.


    Thursday, July 24, 2014 2:09 AM
    Moderator
  • Format for  InvalidPluginExecutionException goes as follows:

    InvalidPluginExecutionException (Microsoft.Xrm.Sdk.OperationStatus status, int errorcode, string message)

    I would try adding a status and error code.

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 2:40 PM
  • I have tried all different syntax's with and without all parameters, but didn't had a luck.

    That above "Value can not be null" was related to some other issue. that doesn't appear any more. things are getting frustrated here.

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:19 PM
  • Seems like the Business Process Error is encountered in your plugin at some point before you are attempting to raise the InvalidPluginExecutionException, therefore it is reporting something generic.  Have you stepped through the code to be sure?

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:30 PM
  • yes I did step through so many times. It goes to that exception  InvalidPluginExecutionException just fine and after that syntax it goes to catch block and throw the message.

    Nothing special about this and I don't understand after that syntax is that system level error or what??

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:35 PM
  • Did I read correctly that you are catching the exception and re-throwing?  Reading your trace it seems like your error is reported as the INNER exception.  CRM will only report on the OUTER exception in the UI. 
    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:48 PM
  • What do you mean. I try throwing only one time as well, but no luck. can you please provide sample code for at least one function with that syntax that work for you??
    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 7:59 PM
  • Ok.  Generic Example:

    try
    {
    //--  Execute Code Here  --
    }
    catch (Exception ex)
    {
    //--  Throw new Execution Error  --
    throw new InvalidPluginExecutionException(Microsoft.Xrm.Sdk.OperationStatus.Failed, -2147220956, "Execution Failed Error");
    }

    • Marked as answer by Nicksoft2011 Friday, July 25, 2014 3:37 PM
    Thursday, July 24, 2014 8:08 PM