Skip to main content

Notifications

Customer Service forum
Suggested answer

What is the function of DisableCrossThreadSafeties? Is there any risk if it is set to true or false

Posted on by Microsoft Employee

I have a concurrent program to request crm, and then I found that the DisableCrossThreadSafeties property setting of CrmServiceClient supports concurrency, and found that setting it to true increases the concurrency efficiency by 50%. Is there any risk to crm or thread safety issues?

CrmServiceClient svc = new CrmServiceClient(ConfigurationManager.AppSettings["ConnStr"]);
svc.DisableCrossThreadSafeties = true;

Set to false: the total time-consuming program runs to completion, time-consuming: 164930 list count: 320 average each millisecond: 515

Set to true Total time-consuming program to run to completion, time-consuming: 79941 list count: 320 average each millisecond: 249

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: What is the function of DisableCrossThreadSafeties? Is there any risk if it is set to true or false

    Hi,

    CrmServiceClient itself is thread safe, but if you use DisableCrossThreadSafeties, it will cause thread safety issues.

    You can refer to the official API documentation, here is a very clear statement:

    CrmServiceClient.DisableCrossThreadSafeties Property (Microsoft.Xrm.Tooling.Connector) | Microsoft Docs

    pastedimage1627522507237v1.jpeg

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Frank Gong

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,867 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,173 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans