Skip to content

Commit

Permalink
Extended XML doc to explicitly mention the implementations of IAsyncC…
Browse files Browse the repository at this point in the history
…ontext<T>, IAsyncState and IAsyncLocalContext are not thread safe.
  • Loading branch information
Martin Obratil committed Jan 15, 2024
1 parent c61c342 commit 0800989
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public static class AsyncStateHttpContextExtensions
/// <summary>
/// Adds default implementations for <see cref="IAsyncState"/>, <see cref="IAsyncContext{T}"/>, and <see cref="IAsyncLocalContext{T}"/> services,
/// scoped to the lifetime of <see cref="AspNetCore.Http.HttpContext"/> instances.
/// Please note that implementations of these interfaces are not thread safe.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/> to add the service to.</param>
/// <returns>The value of <paramref name="services"/>.</returns>
Expand Down
2 changes: 1 addition & 1 deletion src/Libraries/Microsoft.AspNetCore.AsyncState/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This provides the ability to store and retrieve state objects that flow with the
The lifetime of the shared data is controlled automatically and will be the same as of `HttpContext`.

> [!NOTE]
> Please note, the implementation `IAsyncContext<T>` is not designed to be thread-safe.
> Please note, the implementation of `IAsyncContext<T>` is not designed to be thread-safe.
## Install the package

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public static class AsyncStateExtensions
{
/// <summary>
/// Adds default implementations for <see cref="IAsyncState"/>, <see cref="IAsyncContext{T}"/>, and <see cref="IAsyncLocalContext{T}"/> services.
/// Please note that implementations of these interfaces are not thread safe.
/// </summary>
/// <param name="services">The dependency injection container to add the implementations to.</param>
/// <returns>The value of <paramref name="services"/>.</returns>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Microsoft.Extensions.AsyncState;

/// <summary>
/// Provides access to the current async context.
/// Some implementations of this interface may not be thread safe.
/// </summary>
/// <typeparam name="T">The type of the asynchronous state.</typeparam>
[SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "Getter and setter throw exceptions.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace Microsoft.Extensions.AsyncState;

/// <summary>
/// Provides access to the current async context stored outside of the HTTP pipeline.
/// Some implementations of this interface may not be thread safe.
/// </summary>
/// <typeparam name="T">The type of the asynchronous state.</typeparam>
/// <remarks>This type is intended for internal use. Use <see cref="IAsyncContext{T}"/> instead.</remarks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace Microsoft.Extensions.AsyncState;

/// <summary>
/// Encapsulates all information within the asynchronous flow in an <see cref="AsyncLocal{T}"/> variable.
/// Some implementations of this interface may not be thread safe.
/// </summary>
[SuppressMessage("Naming", "CA1716:Identifiers should not match keywords", Justification = "Getter and setter throw exceptions.")]
public interface IAsyncState
Expand Down

0 comments on commit 0800989

Please sign in to comment.