github / github/codeql

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

Đang mở
#20,032 6 bình luận 0 reaction 1 người được giao Được @michaelnebel nhận Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.