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?