Nullness issue - Async.SwitchToContext lacks a null annotation on its parameter #18055
Closed
1 of 7 tasks
Labels
Area-Nullness
Issues related to handling of Nullable Reference Types
Bug
good first issue
help wanted
Milestone
Issue description
I believe that Async.SwitchToContext should take a parameter of type
System.Threading.SynchronizationContext | null
. Examining the function body, you can see that it treats null as a possible argument and handles it normally (without throwing an exception).Choose one or more from the following categories of impact
null
constructs in code not using the checknulls switch.null
,not null
).Operating System
Windows (Default)
What .NET runtime/SDK kind are you seeing the issue on
.NET SDK (.NET Core, .NET 5+)
.NET Runtime/SDK version
net9.0
Reproducible code snippet and actual behavior
No response
Possible workarounds
One can write a wrapper function which when given null calls Async.SwitchToThreadPool, otherwise calls SwitchToContext with the non-null syncContext.
The text was updated successfully, but these errors were encountered: