Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

How to solve CrmServiceClient concurrency bug

(0) ShareShare
ReportReport
Posted on by 45

Hello. I am developing software for large data transfers from and to Dynamics 365 online. And i am using OrganizationService (from 7.0 library) and it works just fine with my amounts of requests and my concurrency. I tried to migrate to CrmServiceClient(9.0.0.7) with no success. After a while all(!) of my request start getting error "Object reference not set to an instance of an object." from Microsoft.Xrm.Tooling.Connector . I searched here and all can find in this first answer in this thread: https://community.dynamics.com/crm/f/117/t/239768 . As I understand - after first error from my request (timeout/already exist/not found) shared connection disposes itself and all other threads (Tasks) start getting this error. I Already tried:

1) Every reqeust send in using(var con = new CrmServiceClient(connectionStr)) {  ....   }

2) Manual call con.Dispose()

3) Don't use Dispose at all

4) CrmServiceClient in singleton (but it doesn't fit a lot of my already existing logic)

5) CreateNewInstance = true. But this is so slow that it doesn't fit my need in 6millions requests/day

Also request via CrmServiceClient  is so much slower then OrganizationService.

Maybe i am missing something? Maybe there is a way to not get this disposed error? Or maybe it is better to use OrganizationServiceProxy? 

Categories:

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans