Reputation: 1075
Is the Graph dotNet sdk implemented Thread-Safe in all Areas?
E.g. Multiple Worker Threads want to retrieve user EMails:
var request = graphClient.Users[usrId].Messages.Request().Top(top).Select(select).Skip(10);
var result = await request.GetAsync();
Sending/executing Requests should be Thread-Safe as each of them is exceuted in their own task. But Is the creation of Requests implemented Thread-Safe?
So my Questions are
Upvotes: 2
Views: 1045
Reputation: 3465
No, the .Net Graph Client library is not implemented thread-safe in all areas. From a quick review of the library code, the BaseClient baseUrl is settable which could enable a scenario where two threads are accessing that variable. This could result in requests being made to unexpected baseUrls. Once a request has been built past the baseUrl provided by the GraphServiceClient, the creation of request is expected to be thread safe.
Regarding access to the Graph client instance and thread safety, if I understand correctly, that is a matter of how you design your application's access to the library.
--Update 7/15/2024-- I have no idea whether this is still true. I would need to go review the code again. Just wanted to make this statement as there is still activity in this post.
Upvotes: 4