diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll index 99f372fe4ac..191817d2a76 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/ExternalFlow.qll @@ -101,6 +101,7 @@ private module Frameworks { private import semmle.code.csharp.frameworks.system.io.Compression private import semmle.code.csharp.frameworks.system.Xml private import semmle.code.csharp.frameworks.system.threading.Tasks + private import semmle.code.csharp.frameworks.system.runtime.CompilerServices } /** diff --git a/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll b/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll index 15ebace825a..c33c22752fe 100644 --- a/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll +++ b/csharp/ql/lib/semmle/code/csharp/dataflow/LibraryTypeDataFlow.qll @@ -1391,25 +1391,6 @@ private class SyntheticConfiguredTaskAwaiterField extends SyntheticField { } } -/** Data flow for `System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>`. */ -private class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTFlow extends LibraryTypeDataFlow, - SystemRuntimeCompilerServicesConfiguredTaskAwaitableTStruct { - override predicate callableFlow( - CallableFlowSource source, AccessPath sourceAp, CallableFlowSink sink, AccessPath sinkAp, - SourceDeclarationCallable c, boolean preservesValue - ) { - // var awaitable = task.ConfigureAwait(false); - // var awaiter = awaitable.GetAwaiter(); // <-- awaitable.m_configuredTaskAwaiter - // var result = awaiter.GetResult(); - c = this.getGetAwaiterMethod() and - source = TCallableFlowSourceQualifier() and - sourceAp = AccessPath::synthetic(any(SyntheticConfiguredTaskAwaiterField s)) and - sink = TCallableFlowSinkReturn() and - sinkAp = AccessPath::empty() and - preservesValue = true - } -} - /** Data flow for `System.Runtime.CompilerServices.TaskAwaiter<>`. */ class SystemRuntimeCompilerServicesTaskAwaiterFlow extends LibraryTypeDataFlow, SystemRuntimeCompilerServicesTaskAwaiterStruct { diff --git a/csharp/ql/lib/semmle/code/csharp/frameworks/system/runtime/CompilerServices.qll b/csharp/ql/lib/semmle/code/csharp/frameworks/system/runtime/CompilerServices.qll index 3f860a23dae..a5653fc0c08 100644 --- a/csharp/ql/lib/semmle/code/csharp/frameworks/system/runtime/CompilerServices.qll +++ b/csharp/ql/lib/semmle/code/csharp/frameworks/system/runtime/CompilerServices.qll @@ -2,6 +2,7 @@ import csharp private import semmle.code.csharp.frameworks.system.Runtime +private import semmle.code.csharp.dataflow.ExternalFlow /** The `System.Runtime.CompilerServices` namespace. */ class SystemRuntimeCompilerServicesNamespace extends Namespace { @@ -44,6 +45,14 @@ class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTStruct extends System } } +/** Data flow for `System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>`. */ +private class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTFlowModelCsv extends SummaryModelCsv { + override predicate row(string row) { + row = + "System.Runtime.CompilerServices;ConfiguredTaskAwaitable<>;false;GetAwaiter;();;SyntheticField[m_configuredTaskAwaiter] of Argument[-1];ReturnValue;value" + } +} + /** The `System.Runtime.CompilerServices.ConfiguredTaskAwaitable<>.ConfiguredTaskAwaiter` struct. */ class SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiterStruct extends Struct { SystemRuntimeCompilerServicesConfiguredTaskAwaitableTConfiguredTaskAwaiterStruct() {