Skip to content

AsyncLocal<T> Class Article #13091

Open
Open

Description

@suvamtamang

Type of issue

Other (describe below)

Description

The example output provided in this specific article is incorrect. Rather than
// The example displays the following output:
// Entering AsyncMethodB.
// Expected 'Value 1', AsyncLocal value is 'Value 1', ThreadLocal value is 'Value 1'
// Entering AsyncMethodB.
// Expected 'Value 2', AsyncLocal value is 'Value 2', ThreadLocal value is 'Value 2'
// Exiting AsyncMethodB.
// Expected 'Value 2', got 'Value 2', ThreadLocal value is ''
// Exiting AsyncMethodB.
// Expected 'Value 1', got 'Value 1', ThreadLocal value is ''

It should have been
Entering AsyncMethodB.
Expected 'Value 1', AsyncLocal value is 'Value 1', ThreadLocal value is 'Value 1'
Entering AsyncMethodB.
Expected 'Value 2', AsyncLocal value is 'Value 2', ThreadLocal value is 'Value 2'
Exiting AsyncMethodB.
Expected 'Value 1', got 'Value 1', ThreadLocal value is ''
Exiting AsyncMethodB.
Expected 'Value 2', got 'Value 2', ThreadLocal value is ''

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.threading.asynclocal-1?view=net-10.0

Content source URL

https://github.com/dotnet/dotnet-api-docs-temp/blob/live/xml/System.Threading/AsyncLocal`1.xml

Document Version Independent Id

05321180-eca9-f7dd-9abc-2111f2d0dc19

Platform Id

39033060-77e9-4a7f-b5e4-5a827208dab7

Article author

@dotnet-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions