pnp / pnp/pnpframework

Clarification Needed: Thread-Safety of AuthenticationManager.GetACSAppOnlyContext

Open
#438 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
259
Forks
161
Avg merge
10h 33m
Merged PRs (30d)
1

Description

Trying to understand whether we can reuse a single ClientContext instance to run some operations through multiple threads, such as uploading many files, where we run await clientContext.ExecuteQueryRetryAsync();.

Would you please help clarify the thread safety of type PnP.Framework.AuthenticationManager and type Microsoft.SharePoint.Client.ClientContext?

For multi-threaded scenarios,
Should I call below line to create new AuthenticationManager instance and get new ClientContext every time?

new AuthenticationManager().GetACSAppOnlyContext(this.SiteUrl, appClientId, appSecret);

Or can we use a singleton of AuthenticationManager or even ClientContext? not sure whether there is some caching done when I call GetACSAppOnlyContext first time for reuse for later calls.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AuthenticationManager.GetACSAppOnlyContext and Microsoft.SharePoint.Client.ClientContext, focusing on the multi-threaded ExecuteQueryRetryAsync scenario described in the issue. Determine whether AuthenticationManager or ClientContext instances can be shared safely, whether caching occurs, and document clear guidance for singleton versus per-operation instances.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
authentication
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.