Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Race condition using Microsoft.Xrm.Tooling.Connector

(0) ShareShare
ReportReport
Posted on by 7
We have an IIS site with a web api service hosted on premise. The Web Api service connects to Dynamic 365 online through Microsoft.Xrm.Tooling.Connection.dll api.
We experience sporadic 100% CPU usage in our environment when multiple concurrent users use the web api service, and connects from the service to CRM 365 Online.
We use CrmServiceClient class "">docs.microsoft.com/.../microsoft.xrm.tooling.connector.crmserviceclient configured with the following connection string "AuthType = Office365; Url = .... ....; RequireNewInstance = True"; RequireNewInstance = True parameter means a new instance for each connection.
We are experiencing a race condition, where several different threads try to insert and read in the same dictionary, at the same time in the Microsoft.Xrm.Sdk.Client.IdentityProviderLookup class. 
I've decompiled the Microsoft.Xrm.Sdk dll and found that the IdentityProviderLookup class is implemented as a singleton class, with no lock around the method that reads and writes to the dictionary, so concurrent threads will hit the same method, and an occasional race condition occurs. 
Any one have a safe way to connect multiple thread to CRM 365 Online without getting any race conditions ?
The issue has already been reported to Microsoft support.
Regards
Niels Greve Andersen

*This post is locked for comments

  • Niels Greve Profile Picture
    Niels Greve 7 on at
    RE: Race condition using Microsoft.Xrm.Tooling.Connector

    Thanks Matt, I was the "guy" reporting it to Microsoft, so we where the first to get the update from Microsoft last year.

    Regards Niels

  • Suggested answer
    MattB-MSFT Profile Picture
    MattB-MSFT on at
    RE: Race condition using Microsoft.Xrm.Tooling.Connector

    This was recently brought up again in mid year 2020, and this post was referred too. To close the loop for other searchers,  this was fixed shortly after this report was made and the updated assemblies were posted in November / December of 2019.

    This impacts only WS-TRUST based auth flows ( office365 / IFD / etc ) and does not impact JWT flows ( oAuth / Service Principal )

    To resolve this, you need to use Nuget Packages Microsoft.CrmSdk.CoreAssemblies 9.0.2.23+ and current versions of Microsoft.CrmSdk.XrmTooling.CoreAssemblies.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans