Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Cannot access a disposed object.

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

  • RietO Profile Picture
    RietO 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.

  • Community Member Profile Picture
    Community Member Microsoft Employee 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 .

  • 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

  • Verified answer
    Moh Helper Profile Picture
    Moh Helper 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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans