Merge pull request #15085 from michaelnebel/csharp/telemetrycalls

C#: Telemetry should only count calls in source.
This commit is contained in:
Michael Nebel
2023-12-13 13:46:16 +01:00
committed by GitHub
6 changed files with 12 additions and 4 deletions

View File

@@ -134,7 +134,8 @@ module Results<relevantApi/1 getRelevantUsages> {
strictcount(Call c, ExternalApi api |
c.getTarget().getUnboundDeclaration() = api and
apiName = api.getApiName() and
getRelevantUsages(api)
getRelevantUsages(api) and
c.fromSource()
)
}

View File

@@ -14,7 +14,8 @@ private predicate getRelevantUsages(string namespace, int usages) {
usages =
strictcount(Call c, ExternalApi api |
c.getTarget().getUnboundDeclaration() = api and
api.getNamespace() = namespace
api.getNamespace() = namespace and
c.fromSource()
)
}

View File

@@ -0,0 +1,2 @@
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj

View File

@@ -1,2 +1,3 @@
semmle-extractor-options: /r:System.Collections.Specialized.dll
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Web.cs

View File

@@ -1,2 +1,3 @@
semmle-extractor-options: /r:System.Collections.Specialized.dll
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Web.cs

View File

@@ -0,0 +1,2 @@
semmle-extractor-options: /nostdlib /noconfig
semmle-extractor-options: --load-sources-from-project:${testdir}/../../../resources/stubs/_frameworks/Microsoft.NETCore.App/Microsoft.NETCore.App.csproj