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)

Cannot access a disposed object.

(0) ShareShare
ReportReport
Posted on by 20

We have Upgraded CRM Onprmise version with 8.2.1 and dll also in WFC service.

We are getting error as mention below when we upgraded Microsoft dll to version 8.2.0 or above

with version 8.1.0 it works fine.

Error Details : Cannot access a disposed object.
Object name: 'System.ServiceModel.Security.TransportSecurityProtocol'.

Stack trace:

Server stack trace:
 at System.ServiceModel.Channels.CommunicationObject.ThrowIfClosedOrNotOpen()
 at System.ServiceModel.Security.TransportSecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout)
 at System.ServiceModel.Security.SecurityProtocol.VerifyIncomingMessage(Message& message, TimeSpan timeout, SecurityProtocolCorrelationState[] correlationStates)
 at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
 at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
 at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
 at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
 at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
 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.Xrm.Sdk.IOrganizationService.Execute(OrganizationRequest request)
 at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.ExecuteCore(OrganizationRequest request)
 at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request)
 at Microsoft.Xrm.Sdk.Linq.QueryProvider.RetrieveEntityCollection(OrganizationRequest request, NavigationSource source)
 at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute(QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups, String& pagingCookie, Boolean& moreRecords)
 at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](QueryExpression qe, Boolean throwIfSequenceIsEmpty, Boolean throwIfSequenceNotSingle, Projection projection, NavigationSource source, List`1 linkLookups)
 at Microsoft.Xrm.Sdk.Linq.QueryProvider.Execute[TElement](Expression expression)
 at Microsoft.Xrm.Sdk.Linq.QueryProvider.GetEnumerator[TElement](Expression expression)
 at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
 at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Moh Helper Profile Picture
    250 on at
    RE: Cannot access a disposed object.

    Hi Prajwal,

    Can you put the line where you make the connection to crm as below and look if the error still occured :

    using (CrmServiceClient client = CrmServiceFactory.Get("myCRM"))

    {

       client.Something();

       client.SomethingElse();

    }

    Kr,

    Mohamed

  • Cannot access a disposed object. Object name Profile Picture
    20 on at
    RE: Cannot access a disposed object.

    Hi Mohamed,

    Issue is related to CrmServiceClient  only but we fixed it in different way.

    Thanks for your reply

    /Prajwal

  • Community Member Profile Picture
    on at
    RE: Cannot access a disposed object.

    Hello Prajwal,

    We are also getting the same error.Could you please let me know how you fixed it? We are using the new XRMTooling and using the version 9.0.0.5 for the SDK .

  • RietO Profile Picture
    on at
    RE: Cannot access a disposed object.

    Could you please share how you fixed it? When you asked the question you were hoping for an answer, now I am.

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
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans