Analyzer: Type used in PInvoke should report RUC on default constructor
Open
area-Linker: Diagnostic
- Dominant language
- C#
- Stars
- 392
- Forks
- 128
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 2
Description
```C#
void Test()
{
PInvokeWithResult();
}
// IL2026 - Foo
[DllImport("nonexistent")]
static extern ResultType PInvokeWithResult();
class ResultType {
[RequiresUnreferencedCode("Foo")]
public ResultType() { }
}
```
Types used in PInvoke are potentially instantiated by the runtime via default .ctors. Thus if the .ctor is annotated with RUC this should cause a warning.
This is probably a very low priority thing to fix in the analyzer, since this would be very uncommon.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.