-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Type of issue
Missing information
Description
Hello,
I am trying to resolve warnings concerning MSTEST0049: Flow TestContext cancellation token.
It would be nice if there were an async test example that would show a way to properly get the TestContext within an async test method and then use the CancellationToken of it.
In my cases the provided code fixer does create a property public TestContext TestContext { get; set; } and use it to get the CancellationToken of it. So far so good.
But now I run into CS8602: Possible dereference of null since the compiler does not see the property being set.
Can I simply ignore (!) this? Is this the proper way?
Related to #52340
Page URL
https://learn.microsoft.com/en-us/dotnet/core/testing/mstest-analyzers/mstest0049
Content source URL
https://github.com/dotnet/docs/blob/main/docs/core/testing/mstest-analyzers/mstest0049.md
Document Version Independent Id
11c7ec45-be3b-5457-c153-7a6e18432673
Platform Id
a38be9f6-7220-b23e-82fc-69b19cc33c6a
Article author
Metadata
- ID: dcd4363a-81ca-4b25-6147-d0ed5a5f28c0
- PlatformId: a38be9f6-7220-b23e-82fc-69b19cc33c6a
- Service: dotnet-fundamentals