github / github/codeql

General issue: Find the annotated type of a C# base interface

オープン
#20,032 コメント 6 件 リアクション 0 件 担当者 1 名 @michaelnebel が担当を希望しています GitHub で見る
question
主要言語
CodeQL
スター
10.1k
フォーク
2.1k
平均マージ
2日 15時間
マージ済み PR(30日)
141

説明

I'm trying to get the annotated type of the constructed interface that a class implements in C#.

Consider the following C# program:
```csharp
Console.WriteLine("Hello world!");

interface IService
{
T GetValue();
}

class Service : IService
{
public string? GetValue()
{
return null;
}
}
```

If I run the following query on it, `IService` does not appear in the list of annotated types:
```codeql
import csharp

from AnnotatedType at
where at.getType().fromSource()
select at
```

First, I would like `AnnotatedType` to include constructed interfaces implemented by classes complete with the correct annotations. Second, I would like a way to associate the class with the annotated constructed interface, like:
```codeql
from Class c, AnnotatedConstructedType act
where c.fromSource() and
act.appliesTo(c.getABaseInterface())
select c, act
```

If this functionality already exists, could I please have some pointers on how to use it? If not, could it please be implemented?

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。