Aller au contenu

Wrong option passed to TaskCompletionSource (CA2247)

Ce contenu n’est pas encore disponible dans votre langue.

Key dotnet.async.taskcompletionsource-options · Severity error · Category async

Microsoft analyzer CA2247. Flags a TaskContinuationOptions value passed to the TaskCompletionSource constructor, which expects TaskCreationOptions. It compiles and means something else entirely.

var tcs = new TaskCompletionSource(TaskContinuationOptions.RunContinuationsAsynchronously);
var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);