web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Issue with plugin after upgrade to CRM 2016

(0) ShareShare
ReportReport
Posted on by 4,930

Hi,

we recently upgraded from CRM 2015 to CRM 2016 on premise and one plugin, which was working fine in CRM 2015, is no longer working in CRM 2016.

I already changed the SDK dlls in the references of the plugin from the 2015 ones to the new 2016 dlls and updated the plugin assembly, but still it doesn't work.

It always throws the error:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=xxx]]: Unexpected exception from plug-in (Execute): CrmVSSolution1.Plugins.PostZuwendungCreate: System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
  <ErrorCode>-2147220956</ErrorCode>
  <ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />
  <Message>Unexpected exception from plug-in (Execute): CrmVSSolution1.Plugins.PostZuwendungCreate: System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.</Message>
  <Timestamp>2016-12-16T21:52:21.7150974Z</Timestamp>
  <InnerFault i:nil="true" />
  <TraceText>

Any idea, what could be wrong?

thx in advance Thomas

This is the source code of the plugin:

// <copyright file="PostZuwendungCreate.cs" company="">

// Copyright (c) 2016 All Rights Reserved

// </copyright>

// <author></author>

// <date>12/15/2016 1:32:49 PM</date>

// <summary>Implements the PostZuwendungCreate Plugin.</summary>

// <auto-generated>

// This code was generated by a tool.

// Runtime Version:4.0.30319.1

// </auto-generated>

namespace CrmVSSolution1.Plugins

{

using System;

using System.ServiceModel;

using Microsoft.Xrm.Sdk;

using Microsoft.Crm.Sdk.Messages;

/// <summary>

/// PostZuwendungCreate Plugin.

/// </summary>

public class PostZuwendungCreate: Plugin

{

/// <summary>

/// Alias of the image registered for the snapshot of the

/// primary entity's attributes after the core platform operation executes.

/// The image contains the following attributes:

/// pb_anzahl_tickets,pb_geschenk,pb_art_geschenk,pb_status_tickets,statuscode

///

/// Note: Only synchronous post-event and asynchronous registered plug-ins

/// have PostEntityImages populated.

/// </summary>

private readonly string postImageAlias = "PostImage";

/// <summary>

/// Initializes a new instance of the <see cref="PostZuwendungCreate"/> class.

/// </summary>

public PostZuwendungCreate()

: base(typeof(PostZuwendungCreate))

{

base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(40, "Create", "fax", new Action<LocalPluginContext>(ExecutePostZuwendungCreate)));

base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(40, "Update", "fax", new Action<LocalPluginContext>(ExecutePostZuwendungCreate)));

// Note : you can register for more events here if this plugin is not specific to an individual entity and message combination.

// You may also need to update your RegisterFile.crmregister plug-in registration file to reflect any change.

}

/// <summary>

/// Executes the plug-in.

/// </summary>

/// <param name="localContext">The <see cref="LocalPluginContext"/> which contains the

/// <see cref="IPluginExecutionContext"/>,

/// <see cref="IOrganizationService"/>

/// and <see cref="ITracingService"/>

/// </param>

/// <remarks>

/// For improved performance, Microsoft Dynamics CRM caches plug-in instances.

/// The plug-in's Execute method should be written to be stateless as the constructor

/// is not called for every invocation of the plug-in. Also, multiple system threads

/// could execute the plug-in at the same time. All per invocation state information

/// is stored in the context. This means that you should not use global variables in plug-ins.

/// </remarks>

protected void ExecutePostZuwendungCreate(LocalPluginContext localContext)

{

if (localContext == null)

{

throw new ArgumentNullException("localContext");

}

IPluginExecutionContext context = localContext.PluginExecutionContext;

IOrganizationService service = localContext.OrganizationService;

ITracingService trace = localContext.TracingService;

// Image für Update Step

Entity postImageEntity = (context.PostEntityImages != null && context.PostEntityImages.Contains(this.postImageAlias)) ? context.PostEntityImages[this.postImageAlias] : null;

// TODO: Implement your custom Plug-in business logic.

try

{

if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)

{

Entity entity = (Entity)context.InputParameters["Target"];

// Verify that the target entity represents a fax.

// If not, this plug-in was not registered correctly.

if (entity.LogicalName == "fax")

{

if (context.MessageName == "Create")

{

// Check ob Zuwendungs-Art gleich Ticket ist

int value = ((OptionSetValue)entity.Attributes["pb_art_geschenk"]).Value;

if (value == 108560002)

{

// Feld Zuwendung

EntityReference pbgeschenk = (EntityReference)entity.Attributes["pb_geschenk"];

Entity geschenk = service.Retrieve(pbgeschenk.LogicalName, pbgeschenk.Id, new Microsoft.Xrm.Sdk.Query.ColumnSet(true));

CalculateRollupFieldRequest rollupRequest=

new CalculateRollupFieldRequest {Target = new EntityReference(geschenk.LogicalName, geschenk.Id), FieldName = "pb_anzahl_tickets"};

CalculateRollupFieldResponse response =(CalculateRollupFieldResponse)service.Execute(rollupRequest);

geschenk = response.Entity;

service.Update(geschenk);

}

}

if (context.MessageName == "Update")

{

// Check ob Zuwendungs-Art gleich Ticket ist

int uvalue = ((OptionSetValue)postImageEntity.Attributes["pb_art_geschenk"]).Value;

if (uvalue == 108560002)

{

// Feld Zuwendung

EntityReference upbgeschenk = (EntityReference)postImageEntity.Attributes["pb_geschenk"];

Entity ugeschenk = service.Retrieve(upbgeschenk.LogicalName, upbgeschenk.Id, new Microsoft.Xrm.Sdk.Query.ColumnSet(true));

CalculateRollupFieldRequest rollupRequest =

new CalculateRollupFieldRequest { Target = new EntityReference(ugeschenk.LogicalName, ugeschenk.Id), FieldName = "pb_anzahl_tickets" };

CalculateRollupFieldResponse response = (CalculateRollupFieldResponse)service.Execute(rollupRequest);

ugeschenk = response.Entity;

service.Update(ugeschenk);

}

}

}

}

}

catch (FaultException<OrganizationServiceFault> ex)

{

throw new InvalidPluginExecutionException("An error occurred in Tickets plugin", ex);

}

// END TODO

}

}

}

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Issue with plugin after upgrade to CRM 2016

    What is the path for the on premise  version

  • SergeRM Profile Picture
    80 on at
    RE: Issue with plugin after upgrade to CRM 2016

    We have exactly the same issue, our setup is 2 Full nodes joined in Windows Cluster, will try this registry fix, but in case Microsoft monitors this site here is trace with exception in their code. "InnerException: System.ArgumentNullException: Value cannot be null."

    # CRM Tracing Version 2.0
    # LocalTime: 2017-09-13 11:59:11.810
    # Categories: *:Error
    # CallStackOn: No
    # ComputerName: prod
    # CRMVersion: 8.2.1.176
    # DeploymentType: OnPremise
    # ScaleGroup:
    # ServerRole: AppServer, AsyncService, DiscoveryService, ApiServer, HelpServer, DeploymentService, SandboxServer, DeploymentManagementTools, VssWriter, EmailConnector

    [2017-09-13 11:59:11.810] Process: w3wp |Organization:b1c2df11-5376-e711-80e7-00505694111a |Thread: 29 |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 00000000-0000-0000-0000-000000000000 |ActivityId: c760eedc-fcf1-424c-91c0-95896a311713 | CrmArgumentNullException..ctor ilOffset = 0x12
    at CrmArgumentNullException..ctor(String message) ilOffset = 0x12
    at SandboxCallManager.CheckCallTracker(SandboxCallInfo sandboxCallInfo) ilOffset = 0x1F
    at SandboxSdkListener.AuthenticateCaller(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation) ilOffset = 0x3F
    at SandboxSdkListener.Execute(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest) ilOffset = 0xE1
    at ilOffset = 0xFFFFFFFF
    at SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) ilOffset = 0x222
    at DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) ilOffset = 0x97
    at ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) ilOffset = 0x48
    at MessageRpc.Process(Boolean isOperationContextSet) ilOffset = 0x65
    at Wrapper.Resume(Boolean& alreadyResumedNoLock) ilOffset = 0x1B
    at ThreadBehavior.ResumeProcessing(IResumeMessageRpc resume) ilOffset = 0x8
    at ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) ilOffset = 0x79
    at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) ilOffset = 0x9
    at QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() ilOffset = 0x35
    at ThreadPoolWorkQueue.Dispatch() ilOffset = 0xA4
    >Crm Exception: Message: callManagerInfo, ErrorCode: -2147220989, InnerException: System.ArgumentNullException: Value cannot be null.
    Parameter name: callManagerInfo
    [2017-09-13 11:59:11.858] Process: w3wp |Organization:00000000-0000-0000-0000-000000000000 |Thread: 29 |Category: Platform.Sdk |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 00000000-0000-0000-0000-000000000000 |ActivityId: be88087b-72c4-43f0-ad23-d76c75048e4e | ServiceModelTraceRedirector.TraceData ilOffset = 0x5D
    >msdn.microsoft.com/.../System.ServiceModel.Diagnostics.TraceHandledException.aspxHandling an exception. Exception details: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: callManagerInfo (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault)./LM/W3SVC/1/ROOT-1-131496580159606300System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]], System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089callManagerInfo at Microsoft.Crm.Sandbox.SandboxSdkListener.Execute(SandboxCallInfo callInfo, SandboxSdkContext requestContext, String operation, Byte[] serializedRequest)
    at SyncInvokeExecute(Object , Object[] , Object[] )
    at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]&amp; outputs)
    at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&amp; rpc)
    at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc&amp; rpc)
    at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: callManagerInfo (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).

  • Suggested answer
    James Rees Profile Picture
    115 on at
    RE: Issue with plugin after upgrade to CRM 2016

    I had a very similar issue in my production environment after upgrading from 2015 to 365 (in-place).  I noticed that all plugins that had isoloation mode set to Sandbox were failing.  Updating them to None fixed the issue.  Not happy with this as a solution (as many of our 3rd party solutions use this mode), I logged the issue with MS support.  The issue turned out to be a consequnece of having a frontend and a backend server.  Our UAT only has a single application server.

    Both servers had the following registry Key set to 1.

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSCRMSandboxService\SingleBox

    Setting this key to 0 (zero) on both servers and rebooting fixed the issue.

    The following article also refers to this fix:

    stackoverflow.com/.../crm-365-callmanagerinfo-error-in-plugins

    Hope this helps someone.

  • tpeschat Profile Picture
    4,930 on at
    RE: Issue with plugin after upgrade to CRM 2016

    Hi.

    We have issues with the sandbox, but didn't figure out why so far. But changing the plugins to not run in sandbox mode helped in dev env.

    br Thomas

  • Community Member Profile Picture
    on at
    RE: Issue with plugin after upgrade to CRM 2016

    Thomas, any clue why it did not work on dev environment? We are facing exactly the same issue...

  • Verified answer
    tpeschat Profile Picture
    4,930 on at
    RE: Issue with plugin after upgrade to CRM 2016

    With the new SDK dlls it works at least in the Produktion env

    BR Tom

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
Aric Levin - MVP Profile Picture

Aric Levin - MVP 2 Moderator

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans