Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CRM 365 callManagerInfo error in plugins

After upgrading CRM 2013 on-premises to CRM365 an issue with plugins started to come up. Each time I try to use IOrganizationService from plugin for any operation I get an error. This issue only occures on multi-server instalation, it didn't occure on CRM 2013 version. It also doesn't occure on single-server instalation of CRM365.

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #52BFF7F3Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
  <ActivityId>c291f3ee-3bfe-4c0d-a631-9b7e70c19add</ActivityId>
  <ErrorCode>-2147220970</ErrorCode>
  <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #52BFF7F3</Message>
  <Timestamp>2017-03-13T12:14:25.2768854Z</Timestamp>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>c291f3ee-3bfe-4c0d-a631-9b7e70c19add</ActivityId>
    <ErrorCode>-2147220891</ErrorCode>
    <ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>callManagerInfo</Message>
    <Timestamp>2017-03-13T12:14:25.2768854Z</Timestamp>
    <ExceptionSource i:nil="true" />
    <InnerFault i:nil="true" />
    <OriginalException i:nil="true" />
    <TraceText>

[PluginsMerged: Core.Plugins.ReadAuditLogPlugin]
[b381844a-41b5-e611-b605-0050568c2255: Core.Plugins.ReadAuditLogPlugin: RetrieveMultiple of account]

Entered Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Core.Plugins.ReadAuditLogPlugin is firing for Entity: account, Message: RetrieveMultiple, Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered internal execute in ReadAuditLogService., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
EnsureInitialized., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetMessage., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetUserFromPlugin., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
user 21391658-381b-e511-80e0-005056931145., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Before context.OrganizationService.Retrieve., Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
callManagerInfo, Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145
Exiting Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 0a738a82-3329-4f60-a6b3-ea8230290d19, Initiating User: 21391658-381b-e511-80e0-005056931145


</TraceText>
  </InnerFault>
  <OriginalException i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>

The code that is throwing this exception is:

private User GetUserFromPlugin(ILocalPluginContext context)
{
    context.Trace("Entered GetUserFromPlugin.");
    var userId = context.PluginExecutionContext.UserId;
    context.Trace(string.Format("user {0}.", userId));

    context.Trace("Before context.OrganizationService.Retrieve.");
    if (context.OrganizationService == null)
    {
        var organizationServiceNullMessage = "OrganizationService is null";
        context.Trace(organizationServiceNullMessage);
        throw new InvalidPluginExecutionException(organizationServiceNullMessage);
    }

    var systemUser = context.OrganizationService.Retrieve(
        EntityNames.CRMSystemUser,
        userId,
        new ColumnSet(FieldNames.CRMSystemUser.DomainName, FieldNames.CRMSystemUser.LastName, FieldNames.CRMSystemUser.FirstName));
    context.Trace("After context.OrganizationService.Retrieve.");

    var user = new User
    {
        Id = userId,
        DomainName = systemUser.ReadAttributeValue<string>(FieldNames.CRMSystemUser.DomainName),
        FirstName = systemUser.ReadAttributeValue<string>(FieldNames.CRMSystemUser.FirstName),
        LastName = systemUser.ReadAttributeValue<string>(FieldNames.CRMSystemUser.LastName),
    };

    return user;
}

---------EDIT----------------

I'm adding information from Plugin Tracing

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: callManagerInfoDetail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>dbe29fd8-651c-47d2-ad39-ed460552d4e1</ActivityId>
<ErrorCode>-2147220891</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d2p1:key>OperationStatus</d2p1:key>
<d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">0</d2p1:value>
</KeyValuePairOfstringanyType>
<KeyValuePairOfstringanyType>
<d2p1:key>SubErrorCode</d2p1:key>
<d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">-2146233088</d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>callManagerInfo</Message>
<Timestamp>2017-03-14T06:09:08.1648164Z</Timestamp>
<ExceptionSource>PluginExecution</ExceptionSource>
<InnerFault i:nil="true" />
<OriginalException>Microsoft.Xrm.Sdk.InvalidPluginExecutionException
at Core.Plugins.BusinessLogic.Service.ReadAuditLogService.Execute(ILocalPluginContext context)
at Core.Plugins.ReadAuditLogPlugin.InternalExecute(LocalPluginContext context)
at Plugins.Common.PluginBase.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.&lt;&gt;c__DisplayClass5.&lt;Execute&gt;b__0()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, Dictionary`2 sandboxServices, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, IPluginExecutionContext requestContext)
at Microsoft.Crm.Sandbox.SandboxWorker.Execute(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, SandboxRequestCounter&amp; workerCounter, Boolean returnTraceInfo)</OriginalException>
<TraceText>
Entered Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Core.Plugins.ReadAuditLogPlugin is firing for Entity: account, Message: RetrieveMultiple, Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered internal execute in ReadAuditLogService., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
EnsureInitialized., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetMessage., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Entered GetUserFromPlugin., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
user 21391658-381b-e511-80e0-005056931145., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Before context.OrganizationService.Retrieve., Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
callManagerInfo, Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
Exiting Core.Plugins.ReadAuditLogPlugin.Execute(), Correlation Id: 50b0f06c-fc66-40b3-acbd-69a2463be0f4, Initiating User: 21391658-381b-e511-80e0-005056931145
</TraceText>
</OrganizationServiceFault>

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 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.ISandboxHost.ExecuteAndReturnTraceInfo(SandboxCallInfo callInfo, SandboxPluginExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String pluginConfiguration, String pluginSecureConfig, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxPlugin.Execute(SandboxClient client, SandboxCallTracker callTracker, IExecutionContext requestContext, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
like image 795
Maco Avatar asked Mar 13 '17 12:03

Maco


People also ask

How do I debug a plugin in Dynamics 365?

In your Visual Studio project, select Debug > Attach to Process…. Select the PluginRegistration.exe process and click Attach. You should see that the Plug-in Registration tool is now running in debug mode. In the Replay Plug-in Execution dialog, click Start Execution.

How do I update my Dynamics 365 Plugin?

Next, you need to go to the Plugin Registration Tool, select the Plugin Assembly itself and click on Update. On this screen, even though you see your plugin already selected, click on the three dots to reselect the Assembly and select the .

Why we need to create security key before registered the plugin?

Found this Microsoft site that gives some information. "Strong-naming an assembly creates a unique identity for the assembly, and can prevent assembly conflicts."


1 Answers

Workaround has been provided to us by Microsoft. To stop error set the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSCRMSandboxService\SingleBox DWord value to 0. After doing that the issue It helped us with the problem.

like image 166
Maco Avatar answered Oct 24 '22 16:10

Maco